l10n->t('Database version'); } public function run(): SetupResult { $version = null; $databasePlatform = $this->connection->getDatabasePlatform(); if ($databasePlatform instanceof MySQLPlatform) { $result = $this->connection->prepare("SHOW VARIABLES LIKE 'version';"); $result->execute(); $row = $result->fetch(); $version = $row['Value']; $versionlc = strtolower($version); // we only care about X.Y not X.Y.Z differences [$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)); } } 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)); } } } elseif ($databasePlatform instanceof PostgreSQLPlatform) { $result = $this->connection->prepare('SHOW server_version;'); $result->execute(); $row = $result->fetch(); $version = $row['server_version']; $versionlc = strtolower($version); // we only care about X not X.Y or X.Y.Z differences [$major, ] = explode('.', $versionlc); $versionConcern = $major; if (version_compare($versionConcern, '12', '<') || version_compare($versionConcern, '16', '>')) { 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)); } } elseif ($databasePlatform instanceof OraclePlatform) { $version = 'Oracle'; } elseif ($databasePlatform instanceof SqlitePlatform) { return SetupResult::warning( $this->l10n->t('SQLite is currently being used as the backend database. For larger installations we recommend that you switch to a different database backend. This is particularly recommended when using the desktop client for file synchronisation. To migrate to another database use the command line tool: "occ db:convert-type".'), $this->urlGenerator->linkToDocs('admin-db-conversion') ); } else { return SetupResult::error($this->l10n->t('Unknown database platform')); } return SetupResult::success($version); } }