Skip to content

Commit

Permalink
in updates XML always resulted in an error (#38121)
Browse files Browse the repository at this point in the history
* <supported_databases> in updates XML always resulted in an error
* Use uppercase for array key and language string key

Co-authored-by: Richard Fath <[email protected]>
  • Loading branch information
Nicholas K. Dionysopoulos and richard67 authored Jun 27, 2022
1 parent 026dc0f commit 0eeae2d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 8 additions & 0 deletions administrator/language/en-GB/lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -758,3 +758,11 @@ JLIB_SIZE_PB="PiB"
JLIB_SIZE_EB="EiB"
JLIB_SIZE_ZB="ZiB"
JLIB_SIZE_YB="YiB"

; Database server technology types in human readable terms. Used in the Updater package.
JLIB_DB_SERVER_TYPE_MARIADB="MariaDB"
JLIB_DB_SERVER_TYPE_MSSQL="Microsoft SQL Server"
JLIB_DB_SERVER_TYPE_MYSQL="MySQL"
JLIB_DB_SERVER_TYPE_ORACLE="Oracle"
JLIB_DB_SERVER_TYPE_POSTGRESQL="PostgreSQL"
JLIB_DB_SERVER_TYPE_SQLITE="SQLite"
11 changes: 7 additions & 4 deletions libraries/src/Updater/Adapter/ExtensionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@ protected function _endElement($parser, $name)
}
}

// $supportedDbs has uppercase keys because they are XML attribute names
$dbTypeUcase = strtoupper($dbType);

// Do we have an entry for the database?
if (\array_key_exists($dbType, $supportedDbs))
if (\array_key_exists($dbTypeUcase, $supportedDbs))
{
$minimumVersion = $supportedDbs[$dbType];
$minimumVersion = $supportedDbs[$dbTypeUcase];
$dbMatch = version_compare($dbVersion, $minimumVersion, '>=');

if (!$dbMatch)
Expand All @@ -168,7 +171,7 @@ protected function _endElement($parser, $name)
'JLIB_INSTALLER_AVAILABLE_UPDATE_DB_MINIMUM',
$this->currentUpdate->name,
$this->currentUpdate->version,
Text::_($db->name),
Text::_('JLIB_DB_SERVER_TYPE_' . $dbTypeUcase),
$dbVersion,
$minimumVersion
);
Expand All @@ -183,7 +186,7 @@ protected function _endElement($parser, $name)
'JLIB_INSTALLER_AVAILABLE_UPDATE_DB_TYPE',
$this->currentUpdate->name,
$this->currentUpdate->version,
Text::_($db->name)
Text::_('JLIB_DB_SERVER_TYPE_' . $dbTypeUcase)
);

Factory::getApplication()->enqueueMessage($dbMsg, 'warning');
Expand Down

0 comments on commit 0eeae2d

Please sign in to comment.