diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-06-25 23:52:11 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-06-27 16:15:16 +0200 |
commit | 6e48ca1cf811a3a8416aa37e9fb4daaac8028ecd (patch) | |
tree | 7b7b447f69f02a4377c1dd2e74d6ee8970fd3d86 | |
parent | d5d180daf633a085b1e27f7ff3fe0f038fa321de (diff) | |
download | nextcloud-server-6e48ca1cf811a3a8416aa37e9fb4daaac8028ecd.tar.gz nextcloud-server-6e48ca1cf811a3a8416aa37e9fb4daaac8028ecd.zip |
fix(settings): Adjust SetupCheck for supported database versions
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | apps/settings/lib/SetupChecks/SupportedDatabase.php | 18 | ||||
-rw-r--r-- | apps/settings/tests/SetupChecks/SupportedDatabaseTest.php | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/apps/settings/lib/SetupChecks/SupportedDatabase.php b/apps/settings/lib/SetupChecks/SupportedDatabase.php index 43807a90251..ede28421068 100644 --- a/apps/settings/lib/SetupChecks/SupportedDatabase.php +++ b/apps/settings/lib/SetupChecks/SupportedDatabase.php @@ -38,8 +38,8 @@ class SupportedDatabase implements ISetupCheck { $version = null; $databasePlatform = $this->connection->getDatabasePlatform(); if ($databasePlatform instanceof MySQLPlatform) { - $result = $this->connection->prepare("SHOW VARIABLES LIKE 'version';"); - $result->execute(); + $statement = $this->connection->prepare("SHOW VARIABLES LIKE 'version';"); + $result = $statement->execute(); $row = $result->fetch(); $version = $row['Value']; $versionlc = strtolower($version); @@ -47,17 +47,19 @@ class SupportedDatabase implements ISetupCheck { [$major, $minor, ] = explode('.', $versionlc); $versionConcern = $major . '.' . $minor; if (str_contains($versionlc, 'mariadb')) { - if (version_compare($versionConcern, '10.3', '<') || version_compare($versionConcern, '10.11', '>')) { - return SetupResult::warning($this->l10n->t('MariaDB version "%s" detected. MariaDB >=10.3 and <=10.11 is suggested for best performance, stability and functionality with this version of Nextcloud.', $version)); + if (version_compare($versionConcern, '10.3', '=')) { + return SetupResult::info($this->l10n->t('MariaDB version 10.3 detected, this version is end-of-life and only supported as part of Ubuntu 20.04. MariaDB >=10.6 and <=11.4 is suggested for best performance, stability and functionality with this version of Nextcloud.')); + } elseif (version_compare($versionConcern, '10.6', '<') || version_compare($versionConcern, '11.4', '>')) { + return SetupResult::warning($this->l10n->t('MariaDB version "%s" detected. MariaDB >=10.6 and <=11.4 is suggested for best performance, stability and functionality with this version of Nextcloud.', $version)); } } else { - if (version_compare($versionConcern, '8.0', '<') || version_compare($versionConcern, '8.3', '>')) { - return SetupResult::warning($this->l10n->t('MySQL version "%s" detected. MySQL >=8.0 and <=8.3 is suggested for best performance, stability and functionality with this version of Nextcloud.', $version)); + if (version_compare($versionConcern, '8.0', '<') || version_compare($versionConcern, '8.4', '>')) { + return SetupResult::warning($this->l10n->t('MySQL version "%s" detected. MySQL >=8.0 and <=8.4 is suggested for best performance, stability and functionality with this version of Nextcloud.', $version)); } } } elseif ($databasePlatform instanceof PostgreSQLPlatform) { - $result = $this->connection->prepare('SHOW server_version;'); - $result->execute(); + $statement = $this->connection->prepare('SHOW server_version;'); + $result = $statement->execute(); $row = $result->fetch(); $version = $row['server_version']; $versionlc = strtolower($version); diff --git a/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php b/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php index 5f97ed41d0a..2492379b557 100644 --- a/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php +++ b/apps/settings/tests/SetupChecks/SupportedDatabaseTest.php @@ -46,7 +46,7 @@ class SupportedDatabaseTest extends TestCase { /** SQlite always gets a warning */ $this->assertEquals(SetupResult::WARNING, $this->check->run()->getSeverity()); } else { - $this->assertEquals(SetupResult::SUCCESS, $this->check->run()->getSeverity()); + $this->assertContains($this->check->run()->getSeverity(), [SetupResult::SUCCESS, SetupResult::INFO]); } } } |