Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions administrator/language/en-GB/en-GB.lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 in version %4$s is not supported please contact your host in to update you Databseversion at least to version %5$s"
Copy link
Contributor

@brianteeman brianteeman Oct 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets fix the germish ;)

+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 you 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a full stop at the end

JLIB_INSTALLER_PURGED_UPDATES="Cleared updates"
JLIB_INSTALLER_FAILED_TO_PURGE_UPDATES="Failed to clear updates."
JLIB_INSTALLER_DEFAULT_STYLE="%s - Default"
Expand Down
63 changes: 62 additions & 1 deletion libraries/joomla/updater/adapters/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -137,6 +142,57 @@ protected function _endElement($parser, $name)
$phpMatch = false;
}

$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 = 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');

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One empty line too much ;)

}
}
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 <supported_databases> tag is not set
$dbMatch = true;
}

// Check minimum stability
$stabilityMatch = true;

Expand All @@ -153,13 +209,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))
{
Expand Down
25 changes: 23 additions & 2 deletions libraries/joomla/updater/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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 = 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 <supported_databases> tag is not set
$dbMatch = true;
}

// Check minimum stability
Expand All @@ -339,7 +360,7 @@ public function _endElement($parser, $name)
$stabilityMatch = false;
}

if ($phpMatch && $stabilityMatch)
if ($phpMatch && $stabilityMatch && $dbMatch)
{
if (isset($this->latest))
{
Expand Down