Skip to content

Commit

Permalink
Readd old JUpdate code to prevent update information to be set.
Browse files Browse the repository at this point in the history
This could have led to wrong behaviour in other places, where JUpdate is used (e.g. extension updater)
  • Loading branch information
Kev1n337 committed Sep 3, 2017
1 parent 2d2028e commit 1d812d5
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion libraries/src/Updater/Update.php
Expand Up @@ -336,8 +336,46 @@ public function _endElement($parser, $name)
&& $patchMinimumSupported
&& $patchMaximumSupported)
{
$phpMatch = false;

// Check if PHP version supported via <php_minimum> tag, assume true if tag isn't present
if (!isset($this->currentUpdate->php_minimum) || version_compare(PHP_VERSION, $this->currentUpdate->php_minimum->_data, '>='))
{
$phpMatch = true;
}

$dbMatch = false;

// Check if DB & version is supported via <supported_databases> tag, assume supported if tag isn't present
if (isset($this->currentUpdate->supported_databases))
{
$db = Factory::getDbo();
$dbType = strtolower($db->getServerType());
$dbVersion = $db->getVersion();
$supportedDbs = $this->currentUpdate->supported_databases;

// Do we have a entry for the database?
if (isset($supportedDbs->$dbType))
{
$minumumVersion = $supportedDbs->$dbType;
$dbMatch = version_compare($dbVersion, $minumumVersion, '>=');
}
}
else
{
// Set to true if the <supported_databases> tag is not set
$dbMatch = true;
}

// Check minimum stability
if (!(isset($this->currentUpdate->stability) && ($this->currentUpdate->stability < $this->minimum_stability)))
$stabilityMatch = true;

if (isset($this->currentUpdate->stability) && ($this->currentUpdate->stability < $this->minimum_stability))
{
$stabilityMatch = false;
}

if ($phpMatch && $stabilityMatch && $dbMatch)
{
if (isset($this->latest))
{
Expand All @@ -351,6 +389,11 @@ public function _endElement($parser, $name)
$this->latest = $this->currentUpdate;
}
}
else
{
$this->latest = new \stdClass;
$this->latest->php_minimum = $this->currentUpdate->php_minimum;
}
}
break;
case 'UPDATES':
Expand Down

0 comments on commit 1d812d5

Please sign in to comment.