-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[com_joomlaupdate] Check for minimum supported database type and version #12355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b81ec6a
initial support supported_databases
zero-24 5c07334
fixes. Thanks Michael
zero-24 c1964df
fix some typos
zero-24 591d0da
oh inconsistencies where you look ... great updater code
zero-24 ecc22f9
en-GB thanks @brianteeman
zero-24 a2647cd
you -> your
zero-24 ce23227
one line to much thanks @yvesh
zero-24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" | ||
| 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" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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,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'); | ||
|
|
||
|
||
| } | ||
| } | ||
| 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; | ||
|
|
||
|
|
@@ -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)) | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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."