Skip to content
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

[4.4] Check database version before update #42083

Closed
wants to merge 4 commits into from

Conversation

Fedik
Copy link
Member

@Fedik Fedik commented Oct 7, 2023

Summary of Changes

Check database version before update

Testing Instructions

set update Minimum Stability to RC
Go to update page,
In overview there will be a new Row about DB Version.

Screenshot 2023-10-07_14-01-08

Then, edit

$dbMin = $this->getTargetMinimumDatabaseVersion($dbType);

Change to $dbMin = '9.0.0';

And open the update page again.
The row with database version should show "No" in "Checked" column

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org:
  • No documentation changes for manual.joomla.org needed

Fedik and others added 2 commits October 7, 2023 14:32
@brianteeman
Copy link
Contributor

This is not correct. See my comments about php

@Fedik
Copy link
Member Author

Fedik commented Oct 7, 2023

I don't really understood your comments there,
It shows No in "Checked" column, if something is wrong, that is good enough to me.

Maybe it is missing a link to "System requirement", but that should be in general description then.

Well, I understood now 😄
But this PR does not fix that, it just add a new point to the compatibility check list.

@Fedik
Copy link
Member Author

Fedik commented Oct 7, 2023

Okay, I close it,
For now it is usless, because user do not get to this page when DB is unsuported

if (isset($this->currentUpdate->supported_databases)) {
$db = Factory::getDbo();
$dbType = strtolower($db->getServerType());
$dbVersion = $db->getVersion();
$supportedDbs = $this->currentUpdate->supported_databases;
// MySQL and MariaDB use the same database driver but not the same version numbers
if ($dbType === 'mysql') {
// Check whether we have a MariaDB version string and extract the proper version from it
if (stripos($dbVersion, 'mariadb') !== false) {
// MariaDB: Strip off any leading '5.5.5-', if present
$dbVersion = preg_replace('/^5\.5\.5-/', '', $dbVersion);
$dbType = 'mariadb';
}
}
// Do we have an entry for the database?
if (isset($supportedDbs->$dbType)) {
$minimumVersion = $supportedDbs->$dbType;
$dbMatch = version_compare($dbVersion, $minimumVersion, '>=');
}
} else {
// Set to true if the <supported_databases> tag is not set
$dbMatch = true;
}

@Fedik Fedik closed this Oct 7, 2023
@brianteeman
Copy link
Contributor

Glad you now see the problem even if you cant fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants