Skip to content

Commit 4560ddd

Browse files
Merge pull request #45241 from nextcloud/checks-db-versions
fix(setupChecks): update db version checks
2 parents b0429e7 + 2915714 commit 4560ddd

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

.github/workflows/phpunit-pgsql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ jobs:
5353
strategy:
5454
matrix:
5555
php-versions: ['8.1']
56-
# To keep the matrix smaller we ignore PostgreSQL '11', '13', '14' as we already test 10 and 15 as lower and upper bound
57-
postgres-versions: ['10', '15', '16']
56+
# To keep the matrix smaller we ignore PostgreSQL '13', '14', and '15' as we already test 12 and 16 as lower and upper bound
57+
postgres-versions: ['12', '16']
5858
include:
5959
- php-versions: '8.3'
60-
postgres-versions: '15'
60+
postgres-versions: '16'
6161
coverage: ${{ github.event_name != 'pull_request' }}
6262

6363
name: PostgreSQL ${{ matrix.postgres-versions }} (PHP ${{ matrix.php-versions }}) - database tests

apps/settings/lib/SetupChecks/SupportedDatabase.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,29 @@ public function run(): SetupResult {
6262
$row = $result->fetch();
6363
$version = $row['Value'];
6464
$versionlc = strtolower($version);
65-
65+
// we only care about X.Y not X.Y.Z differences
66+
[$major, $minor, ] = explode('.', $versionlc);
67+
$versionConcern = $major . '.' . $minor;
6668
if (str_contains($versionlc, 'mariadb')) {
67-
if (version_compare($versionlc, '10.2', '<')) {
68-
return SetupResult::warning($this->l10n->t('MariaDB version "%s" is used. Nextcloud 21 and higher do not support this version and require MariaDB 10.2 or higher.', $version));
69+
if (version_compare($versionConcern, '10.3', '<') || version_compare($versionConcern, '10.11', '>')) {
70+
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));
6971
}
7072
} else {
71-
if (version_compare($versionlc, '8', '<')) {
72-
return SetupResult::warning($this->l10n->t('MySQL version "%s" is used. Nextcloud 21 and higher do not support this version and require MySQL 8.0 or MariaDB 10.2 or higher.', $version));
73+
if (version_compare($versionConcern, '8.0', '<') || version_compare($versionConcern, '8.3', '>')) {
74+
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));
7375
}
7476
}
7577
} elseif ($databasePlatform instanceof PostgreSQLPlatform) {
7678
$result = $this->connection->prepare('SHOW server_version;');
7779
$result->execute();
7880
$row = $result->fetch();
7981
$version = $row['server_version'];
80-
if (version_compare(strtolower($version), '9.6', '<')) {
81-
return SetupResult::warning($this->l10n->t('PostgreSQL version "%s" is used. Nextcloud 21 and higher do not support this version and require PostgreSQL 9.6 or higher.', $version));
82+
$versionlc = strtolower($version);
83+
// we only care about X not X.Y or X.Y.Z differences
84+
[$major, ] = explode('.', $versionlc);
85+
$versionConcern = $major;
86+
if (version_compare($versionConcern, '12', '<') || version_compare($versionConcern, '16', '>')) {
87+
return SetupResult::warning($this->l10n->t('PostgreSQL version "%s" detected. PostgreSQL >=12 and <=16 is suggested for best performance, stability and functionality with this version of Nextcloud.', $version));
8288
}
8389
} elseif ($databasePlatform instanceof OraclePlatform) {
8490
$version = 'Oracle';

0 commit comments

Comments
 (0)