From 3f83ee512395cbe24b42b69950025ae78e9c1a4b Mon Sep 17 00:00:00 2001 From: Shyim Date: Mon, 22 Jul 2024 11:44:31 +0200 Subject: [PATCH] Delete src/Components/Health/Checker/PerformanceChecker/MySQL8Checker.php --- .../PerformanceChecker/MySQL8Checker.php | 70 ------------------- 1 file changed, 70 deletions(-) delete mode 100644 src/Components/Health/Checker/PerformanceChecker/MySQL8Checker.php diff --git a/src/Components/Health/Checker/PerformanceChecker/MySQL8Checker.php b/src/Components/Health/Checker/PerformanceChecker/MySQL8Checker.php deleted file mode 100644 index 02b8fad..0000000 --- a/src/Components/Health/Checker/PerformanceChecker/MySQL8Checker.php +++ /dev/null @@ -1,70 +0,0 @@ -connection->fetchOne('SELECT VERSION()'); - if (!\is_string($version)) { - return; - } - - $extractedVersion = $this->extract($version); - - if (isset($extractedVersion['mariadb'])) { - $collection->add( - SettingsResult::error('mysql8', 'MySQL', $version, 'MySQL 8.0', 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#mysql-instead-of-mariadb') - ); - - return; - } - - if (version_compare($extractedVersion['mysql'] ?? '', '8.0.0', '>=')) { - return; - } - - $collection->add( - SettingsResult::warning('mysql8', 'MySQL', $version, 'MySQL 8.0', 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#mysql-instead-of-mariadb') - ); - } - - /** - * @return array{mysql?: string, mariadb?: string} - */ - private function extract(string $versionString): array - { - if (mb_stripos($versionString, 'mariadb') === false) { - if (mb_strpos($versionString, '-')) { - $versionString = mb_substr($versionString, 0, mb_strpos($versionString, '-')); - } - - return ['mysql' => $versionString]; - } - - return ['mariadb' => self::getVersionNumber($versionString)]; - } - - private static function getVersionNumber(string $versionString): string - { - if (!preg_match( - '/^(?:5\.5\.5-)?(mariadb-)?(?P\d+)\.(?P\d+)\.(?P\d+)/i', - $versionString, - $versionParts - )) { - throw new \RuntimeException(sprintf('Invalid version string: %s', $versionString)); - } - - return $versionParts['major'] . '.' . $versionParts['minor'] . '.' . $versionParts['patch']; - } -}