Skip to content

Commit 273f628

Browse files
authored
Merge pull request #41083 from nextcloud/feat/improve-setup-checks-wording
Improve setup checks naming and improve database version check
2 parents bcc4d7d + 6b7d4b6 commit 273f628

10 files changed

Lines changed: 45 additions & 51 deletions

File tree

apps/dav/lib/SetupChecks/NeedsSystemAddressBookSync.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
}
4141

4242
public function getName(): string {
43-
return $this->l10n->t('Checking for DAV system address book');
43+
return $this->l10n->t('DAV system address book');
4444
}
4545

4646
public function getCategory(): string {

apps/settings/lib/SetupChecks/CheckUserCertificates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getCategory(): string {
4646
}
4747

4848
public function getName(): string {
49-
return $this->l10n->t('Checking for old user imported certificate');
49+
return $this->l10n->t('Old user imported certificates');
5050
}
5151

5252
public function run(): SetupResult {

apps/settings/lib/SetupChecks/DefaultPhoneRegionSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(
3838
}
3939

4040
public function getName(): string {
41-
return $this->l10n->t('Checking for default phone region');
41+
return $this->l10n->t('Default phone region');
4242
}
4343

4444
public function getCategory(): string {

apps/settings/lib/SetupChecks/LegacySSEKeyFormat.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public function getCategory(): string {
4444
}
4545

4646
public function getName(): string {
47-
return $this->l10n->t('Checking for old server-side-encryption being disabled');
47+
return $this->l10n->t('Old server-side-encryption');
4848
}
4949

5050
public function run(): SetupResult {
5151
if ($this->config->getSystemValueBool('encryption.legacy_format_support', false) === false) {
52-
return SetupResult::success();
52+
return SetupResult::success($this->l10n->t('Disabled'));
5353
}
5454
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'));
5555
}

apps/settings/lib/SetupChecks/PhpDefaultCharset.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(
3636
}
3737

3838
public function getName(): string {
39-
return $this->l10n->t('Checking for PHP default charset');
39+
return $this->l10n->t('PHP default charset');
4040
}
4141

4242
public function getCategory(): string {
@@ -45,7 +45,7 @@ public function getCategory(): string {
4545

4646
public function run(): SetupResult {
4747
if (strtoupper(trim(ini_get('default_charset'))) === 'UTF-8') {
48-
return SetupResult::success();
48+
return SetupResult::success('UTF-8');
4949
} else {
5050
return SetupResult::warning($this->l10n->t('PHP configuration option default_charset should be UTF-8'));
5151
}

apps/settings/lib/SetupChecks/PhpOutdated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getCategory(): string {
4242
}
4343

4444
public function getName(): string {
45-
return $this->l10n->t('Checking for PHP version');
45+
return $this->l10n->t('PHP version');
4646
}
4747

4848
public function run(): SetupResult {

apps/settings/lib/SetupChecks/PhpOutputBuffering.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ public function getCategory(): string {
4040
}
4141

4242
public function getName(): string {
43-
return $this->l10n->t('Checking for PHP output_buffering option');
43+
return $this->l10n->t('PHP output_buffering option');
4444
}
4545

4646
public function run(): SetupResult {
4747
$value = trim(ini_get('output_buffering'));
4848
if ($value === '' || $value === '0') {
49-
return SetupResult::success();
49+
return SetupResult::success($this->l10n->t('Disabled'));
5050
} else {
5151
return SetupResult::error($this->l10n->t('PHP configuration option output_buffering must be disabled'));
5252
}

apps/settings/lib/SetupChecks/ReadOnlyConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(
3838
}
3939

4040
public function getName(): string {
41-
return $this->l10n->t('Checking for configuration file access rights');
41+
return $this->l10n->t('Configuration file access rights');
4242
}
4343

4444
public function getCategory(): string {

apps/settings/lib/SetupChecks/SupportedDatabase.php

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,9 @@
2727
*/
2828
namespace OCA\Settings\SetupChecks;
2929

30-
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
31-
use Doctrine\DBAL\Platforms\MySQL57Platform;
32-
use Doctrine\DBAL\Platforms\MySQL80Platform;
3330
use Doctrine\DBAL\Platforms\MySQLPlatform;
3431
use Doctrine\DBAL\Platforms\OraclePlatform;
35-
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
36-
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
32+
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
3733
use Doctrine\DBAL\Platforms\SqlitePlatform;
3834
use OCP\IDBConnection;
3935
use OCP\IL10N;
@@ -52,45 +48,43 @@ public function getCategory(): string {
5248
}
5349

5450
public function getName(): string {
55-
return $this->l10n->t('Checking for database version');
51+
return $this->l10n->t('Database version');
5652
}
5753

5854
public function run(): SetupResult {
59-
switch (get_class($this->connection->getDatabasePlatform())) {
60-
case MySQL80Platform::class: # extends MySQL57Platform
61-
case MySQL57Platform::class: # extends MySQLPlatform
62-
case MariaDb1027Platform::class: # extends MySQLPlatform
63-
case MySQLPlatform::class:
64-
$result = $this->connection->prepare("SHOW VARIABLES LIKE 'version';");
65-
$result->execute();
66-
$row = $result->fetch();
67-
$version = strtolower($row['Value']);
55+
$version = null;
56+
$databasePlatform = $this->connection->getDatabasePlatform();
57+
if ($databasePlatform instanceof MySQLPlatform) {
58+
$result = $this->connection->prepare("SHOW VARIABLES LIKE 'version';");
59+
$result->execute();
60+
$row = $result->fetch();
61+
$version = $row['Value'];
62+
$versionlc = strtolower($version);
6863

69-
if (str_contains($version, 'mariadb')) {
70-
if (version_compare($version, '10.2', '<')) {
71-
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']));
72-
}
73-
} else {
74-
if (version_compare($version, '8', '<')) {
75-
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']));
76-
}
64+
if (str_contains($versionlc, 'mariadb')) {
65+
if (version_compare($versionlc, '10.2', '<')) {
66+
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));
7767
}
78-
break;
79-
case SqlitePlatform::class:
80-
break;
81-
case PostgreSQL100Platform::class: # extends PostgreSQL94Platform
82-
case PostgreSQL94Platform::class:
83-
$result = $this->connection->prepare('SHOW server_version;');
84-
$result->execute();
85-
$row = $result->fetch();
86-
if (version_compare($row['server_version'], '9.6', '<')) {
87-
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']));
68+
} else {
69+
if (version_compare($versionlc, '8', '<')) {
70+
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));
8871
}
89-
break;
90-
case OraclePlatform::class:
91-
break;
72+
}
73+
} elseif ($databasePlatform instanceof PostgreSQLPlatform) {
74+
$result = $this->connection->prepare('SHOW server_version;');
75+
$result->execute();
76+
$row = $result->fetch();
77+
$version = $row['server_version'];
78+
if (version_compare(strtolower($version), '9.6', '<')) {
79+
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));
80+
}
81+
} elseif ($databasePlatform instanceof OraclePlatform) {
82+
$version = 'Oracle';
83+
} elseif ($databasePlatform instanceof SqlitePlatform) {
84+
$version = 'Sqlite';
85+
} else {
86+
return SetupResult::error($this->l10n->t('Unknown database plaform'));
9287
}
93-
// TODO still show db and version on success?
94-
return SetupResult::success();
88+
return SetupResult::success($version);
9589
}
9690
}

apps/user_ldap/lib/SetupChecks/LdapInvalidUuids.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ public function getCategory(): string {
4646
}
4747

4848
public function getName(): string {
49-
return $this->l10n->t('Checking for invalid LDAP UUIDs');
49+
return $this->l10n->t('Invalid LDAP UUIDs');
5050
}
5151

5252
public function run(): SetupResult {
5353
if (count($this->userMapping->getList(0, 1, true)) === 0
5454
&& count($this->groupMapping->getList(0, 1, true)) === 0) {
55-
return SetupResult::success();
55+
return SetupResult::success($this->l10n->t('None found'));
5656
} else {
5757
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.'));
5858
}

0 commit comments

Comments
 (0)