Improve setup checks naming and improve database version check

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/41083/head
Côme Chilliet 2 years ago
parent 13a8a1793c
commit 6b7d4b67d1
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
  1. 2
      apps/dav/lib/SetupChecks/NeedsSystemAddressBookSync.php
  2. 2
      apps/settings/lib/SetupChecks/CheckUserCertificates.php
  3. 2
      apps/settings/lib/SetupChecks/DefaultPhoneRegionSet.php
  4. 4
      apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php
  5. 4
      apps/settings/lib/SetupChecks/PhpDefaultCharset.php
  6. 2
      apps/settings/lib/SetupChecks/PhpOutdated.php
  7. 4
      apps/settings/lib/SetupChecks/PhpOutputBuffering.php
  8. 2
      apps/settings/lib/SetupChecks/ReadOnlyConfig.php
  9. 70
      apps/settings/lib/SetupChecks/SupportedDatabase.php
  10. 4
      apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php

@ -40,7 +40,7 @@ class NeedsSystemAddressBookSync implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for DAV system address book');
return $this->l10n->t('DAV system address book');
}
public function getCategory(): string {

@ -46,7 +46,7 @@ class CheckUserCertificates implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for old user imported certificate');
return $this->l10n->t('Old user imported certificates');
}
public function run(): SetupResult {

@ -38,7 +38,7 @@ class DefaultPhoneRegionSet implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for default phone region');
return $this->l10n->t('Default phone region');
}
public function getCategory(): string {

@ -44,12 +44,12 @@ class LegacySSEKeyFormat implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for old server-side-encryption being disabled');
return $this->l10n->t('Old server-side-encryption');
}
public function run(): SetupResult {
if ($this->config->getSystemValueBool('encryption.legacy_format_support', false) === false) {
return SetupResult::success();
return SetupResult::success($this->l10n->t('Disabled'));
}
return SetupResult::warning($this->l10n->t('The old server-side-encryption format is enabled. We recommend disabling this.'), $this->urlGenerator->linkToDocs('admin-sse-legacy-format'));
}

@ -36,7 +36,7 @@ class PhpDefaultCharset implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for PHP default charset');
return $this->l10n->t('PHP default charset');
}
public function getCategory(): string {
@ -45,7 +45,7 @@ class PhpDefaultCharset implements ISetupCheck {
public function run(): SetupResult {
if (strtoupper(trim(ini_get('default_charset'))) === 'UTF-8') {
return SetupResult::success();
return SetupResult::success('UTF-8');
} else {
return SetupResult::warning($this->l10n->t('PHP configuration option default_charset should be UTF-8'));
}

@ -42,7 +42,7 @@ class PhpOutdated implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for PHP version');
return $this->l10n->t('PHP version');
}
public function run(): SetupResult {

@ -40,13 +40,13 @@ class PhpOutputBuffering implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for PHP output_buffering option');
return $this->l10n->t('PHP output_buffering option');
}
public function run(): SetupResult {
$value = trim(ini_get('output_buffering'));
if ($value === '' || $value === '0') {
return SetupResult::success();
return SetupResult::success($this->l10n->t('Disabled'));
} else {
return SetupResult::error($this->l10n->t('PHP configuration option output_buffering must be disabled'));
}

@ -38,7 +38,7 @@ class ReadOnlyConfig implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for configuration file access rights');
return $this->l10n->t('Configuration file access rights');
}
public function getCategory(): string {

@ -27,13 +27,9 @@ declare(strict_types=1);
*/
namespace OCA\Settings\SetupChecks;
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
use Doctrine\DBAL\Platforms\MySQL57Platform;
use Doctrine\DBAL\Platforms\MySQL80Platform;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use OCP\IDBConnection;
use OCP\IL10N;
@ -52,45 +48,43 @@ class SupportedDatabase implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for database version');
return $this->l10n->t('Database version');
}
public function run(): SetupResult {
switch (get_class($this->connection->getDatabasePlatform())) {
case MySQL80Platform::class: # extends MySQL57Platform
case MySQL57Platform::class: # extends MySQLPlatform
case MariaDb1027Platform::class: # extends MySQLPlatform
case MySQLPlatform::class:
$result = $this->connection->prepare("SHOW VARIABLES LIKE 'version';");
$result->execute();
$row = $result->fetch();
$version = strtolower($row['Value']);
$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);
if (str_contains($version, 'mariadb')) {
if (version_compare($version, '10.2', '<')) {
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.', $row['Value']));
}
} else {
if (version_compare($version, '8', '<')) {
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.', $row['Value']));
}
if (str_contains($versionlc, 'mariadb')) {
if (version_compare($versionlc, '10.2', '<')) {
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));
}
break;
case SqlitePlatform::class:
break;
case PostgreSQL100Platform::class: # extends PostgreSQL94Platform
case PostgreSQL94Platform::class:
$result = $this->connection->prepare('SHOW server_version;');
$result->execute();
$row = $result->fetch();
if (version_compare($row['server_version'], '9.6', '<')) {
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.', $row['server_version']));
} else {
if (version_compare($versionlc, '8', '<')) {
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));
}
break;
case OraclePlatform::class:
break;
}
} elseif ($databasePlatform instanceof PostgreSQLPlatform) {
$result = $this->connection->prepare('SHOW server_version;');
$result->execute();
$row = $result->fetch();
$version = $row['server_version'];
if (version_compare(strtolower($version), '9.6', '<')) {
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));
}
} elseif ($databasePlatform instanceof OraclePlatform) {
$version = 'Oracle';
} elseif ($databasePlatform instanceof SqlitePlatform) {
$version = 'Sqlite';
} else {
return SetupResult::error($this->l10n->t('Unknown database plaform'));
}
// TODO still show db and version on success?
return SetupResult::success();
return SetupResult::success($version);
}
}

@ -46,13 +46,13 @@ class LdapInvalidUuids implements ISetupCheck {
}
public function getName(): string {
return $this->l10n->t('Checking for invalid LDAP UUIDs');
return $this->l10n->t('Invalid LDAP UUIDs');
}
public function run(): SetupResult {
if (count($this->userMapping->getList(0, 1, true)) === 0
&& count($this->groupMapping->getList(0, 1, true)) === 0) {
return SetupResult::success();
return SetupResult::success($this->l10n->t('None found'));
} else {
return SetupResult::warning($this->l10n->t('Invalid UUIDs of LDAP users or groups have been found. Please review your "Override UUID detection" settings in the Expert part of the LDAP configuration and use "occ ldap:update-uuid" to update them.'));
}

Loading…
Cancel
Save