Skip to content

Commit

Permalink
make sure we only apply this for custom and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed Aug 10, 2019
1 parent f8ba0ff commit 8202be9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions administrator/components/com_joomlaupdate/config.xml
Expand Up @@ -28,6 +28,7 @@
label="COM_JOOMLAUPDATE_MINIMUM_STABILITY_LABEL"
description="COM_JOOMLAUPDATE_MINIMUM_STABILITY_DESC"
default="4"
showon="updatesource:testing[OR]updatesource:custom"
>
<option value="0">COM_JOOMLAUPDATE_MINIMUM_STABILITY_DEV</option>
<option value="1">COM_JOOMLAUPDATE_MINIMUM_STABILITY_ALPHA</option>
Expand Down
23 changes: 17 additions & 6 deletions administrator/components/com_joomlaupdate/models/default.php
Expand Up @@ -117,8 +117,14 @@ public function refreshUpdates($force = false)
$cache_timeout = 3600 * JComponentHelper::getParams('com_installer')->get('cachetimeout', 6, 'int');
}

$updater = JUpdater::getInstance();
$minimumStability = JComponentHelper::getParams('com_joomlaupdate')->get('minimum_stability', JUpdater::STABILITY_STABLE);
$updater = JUpdater::getInstance();
$minimumStability = JUpdater::STABILITY_STABLE;
$comJoomlaupdateParams = JComponentHelper::getParams('com_joomlaupdate');

if (in_array($comJoomlaupdateParams->get('updatesource', 'nochange'), ['testing', 'custom']))
{
$minimumStability = $comJoomlaupdateParams->get('minimum_stability', JUpdater::STABILITY_STABLE);
}

$reflection = new ReflectionObject($updater);
$reflectionMethod = $reflection->getMethod('findUpdates');
Expand Down Expand Up @@ -171,13 +177,18 @@ public function getUpdateInformation()
$ret['latest'] = $updateObject->version;
$ret['hasUpdate'] = $updateObject->version != JVERSION;

$minimumStability = JUpdater::STABILITY_STABLE;
$comJoomlaupdateParams = JComponentHelper::getParams('com_joomlaupdate');

if (in_array($comJoomlaupdateParams->get('updatesource', 'nochange'), ['testing', 'custom']))
{
$minimumStability = $comJoomlaupdateParams->get('minimum_stability', JUpdater::STABILITY_STABLE);
}

// Fetch the full update details from the update details URL.
jimport('joomla.updater.update');
$update = new JUpdate;
$update->loadFromXML(
$updateObject->detailsurl,
JComponentHelper::getParams('com_joomlaupdate')->get('minimum_stability', JUpdater::STABILITY_STABLE)
);
$update->loadFromXML($updateObject->detailsurl, $minimumStability);

$ret['object'] = $update;

Expand Down

0 comments on commit 8202be9

Please sign in to comment.