diff --git a/administrator/language/en-GB/en-GB.lib_joomla.ini b/administrator/language/en-GB/en-GB.lib_joomla.ini index 56f8ce0693c0e..0dd8ab583e8e2 100644 --- a/administrator/language/en-GB/en-GB.lib_joomla.ini +++ b/administrator/language/en-GB/en-GB.lib_joomla.ini @@ -527,6 +527,8 @@ JLIB_INSTALLER_ABORT_TPL_INSTALL_FAILED_CREATE_DIRECTORY="Template Install: Fail JLIB_INSTALLER_ABORT_TPL_INSTALL_ROLLBACK="Template Install: %s" JLIB_INSTALLER_ABORT_TPL_INSTALL_UNKNOWN_CLIENT="Template Install: Unknown client type [%s]" JLIB_INSTALLER_AVAILABLE_UPDATE_PHP_VERSION="For the extension %1$s version %2$s is available, but it requires at least PHP version %3$s while your system only has %4$s" +JLIB_INSTALLER_AVAILABLE_UPDATE_DB_MINIMUM="For the extension %1$s version %2$s is available, but your current database %3$s is version %4$s and is not supported. Please contact your web host to update your Database version to at least version %5$s." +JLIB_INSTALLER_AVAILABLE_UPDATE_DB_TYPE="For the extension %1$s version %2$s is available, but your current database %3$s is not supported anymore." JLIB_INSTALLER_PURGED_UPDATES="Cleared updates" JLIB_INSTALLER_FAILED_TO_PURGE_UPDATES="Failed to clear updates." JLIB_INSTALLER_DEFAULT_STYLE="%s - Default" diff --git a/libraries/joomla/updater/adapters/extension.php b/libraries/joomla/updater/adapters/extension.php index 6d4a0fe187222..2c5e1b65e132c 100644 --- a/libraries/joomla/updater/adapters/extension.php +++ b/libraries/joomla/updater/adapters/extension.php @@ -70,6 +70,11 @@ protected function _startElement($parser, $name, $attrs = array()) { $this->currentUpdate->php_minimum = ''; } + + if ($name == 'SUPPORTED_DATABASES') + { + $this->currentUpdate->supported_databases = $attrs; + } break; } } @@ -137,6 +142,56 @@ protected function _endElement($parser, $name) $phpMatch = false; } + $dbMatch = false; + + // Check if DB & version is supported via tag, assume supported if tag isn't present + if (isset($this->currentUpdate->supported_databases)) + { + $db = JFactory::getDbo(); + $dbType = strtoupper($db->getServerType()); + $dbVersion = $db->getVersion(); + $supportedDbs = $this->currentUpdate->supported_databases; + + // Do we have a entry for the database? + if (array_key_exists($dbType, $supportedDbs)) + { + $minumumVersion = $supportedDbs[$dbType]; + $dbMatch = version_compare($dbVersion, $minumumVersion, '>='); + + if (!$dbMatch) + { + // Notify the user of the potential update + $dbMsg = JText::sprintf( + 'JLIB_INSTALLER_AVAILABLE_UPDATE_DB_MINIMUM', + $this->currentUpdate->name, + $this->currentUpdate->version, + JText::_($db->name), + $dbVersion, + $minumumVersion + ); + + JFactory::getApplication()->enqueueMessage($dbMsg, 'warning'); + } + } + else + { + // Notify the user of the potential update + $dbMsg = JText::sprintf( + 'JLIB_INSTALLER_AVAILABLE_UPDATE_DB_TYPE', + $this->currentUpdate->name, + $this->currentUpdate->version, + JText::_($db->name) + ); + + JFactory::getApplication()->enqueueMessage($dbMsg, 'warning'); + } + } + else + { + // Set to true if the tag is not set + $dbMatch = true; + } + // Check minimum stability $stabilityMatch = true; @@ -153,13 +208,18 @@ protected function _endElement($parser, $name) unset($this->currentUpdate->php_minimum); } + if (isset($this->currentUpdate->supported_databases)) + { + unset($this->currentUpdate->supported_databases); + } + if (isset($this->currentUpdate->stability)) { unset($this->currentUpdate->stability); } // If the PHP version and minimum stability checks pass, consider this version as a possible update - if ($phpMatch && $stabilityMatch) + if ($phpMatch && $stabilityMatch && $dbMatch) { if (isset($this->latest)) { diff --git a/libraries/joomla/updater/update.php b/libraries/joomla/updater/update.php index e8053c60002ef..09568038b78e5 100644 --- a/libraries/joomla/updater/update.php +++ b/libraries/joomla/updater/update.php @@ -321,14 +321,35 @@ public function _endElement($parser, $name) && ((!isset($this->currentUpdate->targetplatform->min_dev_level)) || JVersion::DEV_LEVEL >= $this->currentUpdate->targetplatform->min_dev_level) && ((!isset($this->currentUpdate->targetplatform->max_dev_level)) || JVersion::DEV_LEVEL <= $this->currentUpdate->targetplatform->max_dev_level)) { + $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 = JFactory::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 { - $phpMatch = false; + // Set to true if the tag is not set + $dbMatch = true; } // Check minimum stability @@ -339,7 +360,7 @@ public function _endElement($parser, $name) $stabilityMatch = false; } - if ($phpMatch && $stabilityMatch) + if ($phpMatch && $stabilityMatch && $dbMatch) { if (isset($this->latest)) {