diff --git a/libraries/src/Updater/Update.php b/libraries/src/Updater/Update.php index 9080c28261692..058075c1b7a9b 100644 --- a/libraries/src/Updater/Update.php +++ b/libraries/src/Updater/Update.php @@ -336,8 +336,46 @@ public function _endElement($parser, $name) && $patchMinimumSupported && $patchMaximumSupported) { + $phpMatch = false; + + // Check if PHP version supported via 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 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 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)) { @@ -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':