From 9870f6ffe5a52130e858777cec48f0576a625a4a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 12 May 2022 15:31:52 +0200 Subject: [PATCH] Increase minimum MySQL version to 8.0.29 / MariaDB 10.5.12 --- ...oltlab.wcf_5.5_checkSystemRequirements.php | 20 +++++++++++++++++++ ...PackageEnableUpgradeOverrideForm.class.php | 8 ++------ .../lib/acp/page/SystemCheckPage.class.php | 5 ++--- .../files/lib/system/WCFSetup.class.php | 16 +++++---------- wcfsetup/test.php | 4 ++-- 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_checkSystemRequirements.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_checkSystemRequirements.php index dfc6db5a41..6a42d30afd 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_checkSystemRequirements.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_checkSystemRequirements.php @@ -32,3 +32,23 @@ if (\PHP_INT_SIZE != 8) { throw new \RuntimeException($message); } + +$sqlVersion = WCF::getDB()->getVersion(); +$compareSQLVersion = \preg_replace('/^(\d+\.\d+\.\d+).*$/', '\\1', $sqlVersion); +if (\stripos($sqlVersion, 'MariaDB') !== false) { + $neededSqlVersion = '10.5.12'; + $sqlFork = 'MariaDB'; +} else { + $sqlFork = 'MySQL'; + $neededSqlVersion = '8.0.29'; +} + +if (!\version_compare($compareSQLVersion, $neededSqlVersion, '>=')) { + if (WCF::getLanguage()->getFixedLanguageCode() === 'de') { + $message = "Ihre {$sqlFork}-Version '{$sqlVersion}' ist unzureichend für die Installation dieser Software. {$sqlFork}-Version {$neededSqlVersion} oder höher wird benötigt."; + } else { + $message = "Your {$sqlFork} version '{$sqlVersion}' is insufficient for installation of this software. {$sqlFork} version {$neededSqlVersion} or greater is required."; + } + + throw new \RuntimeException($message); +} diff --git a/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php b/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php index cd0fc8631c..e29d844132 100644 --- a/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php @@ -89,15 +89,11 @@ final class PackageEnableUpgradeOverrideForm extends AbstractFormBuilderForm $sqlVersion = WCF::getDB()->getVersion(); $compareSQLVersion = \preg_replace('/^(\d+\.\d+\.\d+).*$/', '\\1', $sqlVersion); if (\stripos($sqlVersion, 'MariaDB') !== false) { - $neededSqlVersion = '10.1.44'; + $neededSqlVersion = '10.5.12'; $sqlFork = 'MariaDB'; } else { $sqlFork = 'MySQL'; - if ($compareSQLVersion[0] === '5') { - $neededSqlVersion = '5.7.31'; - } else { - $neededSqlVersion = '8.0.19'; - } + $neededSqlVersion = '8.0.29'; } if (!\version_compare($compareSQLVersion, $neededSqlVersion, '>=')) { diff --git a/wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php b/wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php index 36db1aea85..ab8af1f11f 100644 --- a/wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php @@ -55,11 +55,10 @@ class SystemCheckPage extends AbstractPage public $mysqlVersions = [ 'mysql' => [ - '5' => '5.7.31', - '8' => '8.0.19', + '8' => '8.0.29', ], 'mariadb' => [ - '10' => '10.1.44', + '10' => '10.5.12', ], ]; diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index f34ba175d5..7bcc2645f9 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -727,7 +727,7 @@ class WCFSetup extends WCF // work-around for older MySQL versions that don't know utf8mb4 case 1115: - throw new SystemException("Insufficient MySQL version. Version '5.7.31' or greater is needed."); + throw new SystemException("Insufficient MySQL version. Version '8.0.29' or greater is needed."); break; default: @@ -739,18 +739,12 @@ class WCFSetup extends WCF $sqlVersion = $db->getVersion(); $compareSQLVersion = \preg_replace('/^(\d+\.\d+\.\d+).*$/', '\\1', $sqlVersion); if (\stripos($sqlVersion, 'MariaDB')) { - if (!(\version_compare($compareSQLVersion, '10.1.44') >= 0)) { - throw new SystemException("Insufficient MariaDB version '" . $compareSQLVersion . "'. Version '10.1.44' or greater is needed."); + if (!(\version_compare($compareSQLVersion, '10.5.12') >= 0)) { + throw new SystemException("Insufficient MariaDB version '" . $compareSQLVersion . "'. Version '10.5.12' or greater is needed."); } } else { - if ($compareSQLVersion[0] === '8') { - // MySQL 8.0.19+ - if (!(\version_compare($compareSQLVersion, '8.0.19') >= 0)) { - throw new SystemException("Insufficient MySQL version '" . $compareSQLVersion . "'. Version '5.7.31' or greater, or version '8.0.19' or greater is needed."); - } - } elseif (!(\version_compare($compareSQLVersion, '5.7.31') >= 0)) { - // MySQL 5.7.31+ - throw new SystemException("Insufficient MySQL version '" . $compareSQLVersion . "'. Version '5.7.31' or greater, or version '8.0.19' or greater is needed."); + if (!(\version_compare($compareSQLVersion, '8.0.29') >= 0)) { + throw new SystemException("Insufficient MySQL version '" . $compareSQLVersion . "'. Version '8.0.29' or greater is needed."); } } diff --git a/wcfsetup/test.php b/wcfsetup/test.php index 3226f0b3c3..bc039058d4 100644 --- a/wcfsetup/test.php +++ b/wcfsetup/test.php @@ -267,8 +267,8 @@ $phrases = [ 'en' => 'MySQL Requirements' ], 'mysql_version' => [ - 'de' => 'Bitte stellen Sie sicher, dass MySQL 5.7.31+/MySQL 8.0.19+ oder MariaDB 10.1.44+ mit InnoDB-Unterstützung vorhanden ist.', - 'en' => 'Please make sure that MySQL 5.7.31+/MySQL 8.0.19+ or MariaDB 10.1.44+, with InnoDB support is available.' + 'de' => 'Bitte stellen Sie sicher, dass MySQL 8.0.29+ oder MariaDB 10.5.12+ mit InnoDB-Unterstützung vorhanden ist.', + 'en' => 'Please make sure that MySQL 8.0.29+ or MariaDB 10.5.12+, with InnoDB support is available.' ], 'result' => [ 'de' => 'Ergebnis', -- 2.20.1