summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-01-16 10:03:22 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2024-03-18 11:10:13 +0100
commitb2cc51cf32b775867d53a5d477f319c62e06a6e7 (patch)
tree196b1db83effc756b978a7608345790befa1a8e2
parentb31d51639d752d4a41184568b6fde50711c442d5 (diff)
downloadnextcloud-server-b2cc51cf32b775867d53a5d477f319c62e06a6e7.tar.gz
nextcloud-server-b2cc51cf32b775867d53a5d477f319c62e06a6e7.zip
Merge gmp and bcmath module checks with the existing PHP modules setup check
Also add description for why each module is recommended Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php11
-rw-r--r--apps/settings/lib/SetupChecks/PhpModules.php21
-rw-r--r--apps/settings/tests/Controller/CheckSetupControllerTest.php7
-rw-r--r--core/js/setupchecks.js9
-rw-r--r--core/js/tests/specs/setupchecksSpec.js47
5 files changed, 20 insertions, 75 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index 074625e02c0..21161be7cf2 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -202,16 +202,6 @@ Raw output
return false;
}
- protected function areWebauthnExtensionsEnabled(): bool {
- if (!extension_loaded('bcmath')) {
- return false;
- }
- if (!extension_loaded('gmp')) {
- return false;
- }
- return true;
- }
-
protected function isMysqlUsedWithoutUTF8MB4(): bool {
return ($this->config->getSystemValue('dbtype', 'sqlite') === 'mysql') && ($this->config->getSystemValue('mysql.utf8mb4', false) === false);
}
@@ -261,7 +251,6 @@ Raw output
[
'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(),
'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'),
- 'areWebauthnExtensionsEnabled' => $this->areWebauthnExtensionsEnabled(),
'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(),
'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(),
'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'),
diff --git a/apps/settings/lib/SetupChecks/PhpModules.php b/apps/settings/lib/SetupChecks/PhpModules.php
index bacf70eb9c9..e1084d68d5a 100644
--- a/apps/settings/lib/SetupChecks/PhpModules.php
+++ b/apps/settings/lib/SetupChecks/PhpModules.php
@@ -69,6 +69,18 @@ class PhpModules implements ISetupCheck {
return 'php';
}
+ protected function getRecommendedModuleDescription(string $module): string {
+ return match($module) {
+ 'bz2' => $this->l10n->t('required for extraction of apps compressed as bz2'),
+ 'intl' => $this->l10n->t('increases language translation performance and fixes sorting of non-ASCII characters'),
+ 'sodium' => $this->l10n->t('for Argon2 for password hashing'),
+ 'bcmath' => $this->l10n->t('for WebAuthn passwordless login'),
+ 'gmp' => $this->l10n->t('for WebAuthn passwordless login, and SFTP storage'),
+ 'exif' => $this->l10n->t('for image rotation in pictures app'),
+ default => '',
+ };
+ }
+
public function run(): SetupResult {
$missingRecommendedModules = $this->getMissingModules(self::RECOMMENDED_MODULES);
$missingRequiredModules = $this->getMissingModules(self::REQUIRED_MODULES);
@@ -78,8 +90,15 @@ class PhpModules implements ISetupCheck {
$this->urlGenerator->linkToDocs('admin-php-modules')
);
} elseif (!empty($missingRecommendedModules)) {
+ $moduleList = implode(
+ "\n",
+ array_map(
+ fn (string $module) => '- '.$module.' '.$this->getRecommendedModuleDescription($module),
+ $missingRecommendedModules
+ )
+ );
return SetupResult::info(
- $this->l10n->t('This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them: %s.', implode(', ', $missingRecommendedModules)),
+ $this->l10n->t("This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them:\n%s", $moduleList),
$this->urlGenerator->linkToDocs('admin-php-modules')
);
} else {
diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php
index f135e075279..bad15a72191 100644
--- a/apps/settings/tests/Controller/CheckSetupControllerTest.php
+++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php
@@ -118,7 +118,6 @@ class CheckSetupControllerTest extends TestCase {
'getCurlVersion',
'isPhpOutdated',
'isPHPMailerUsed',
- 'areWebauthnExtensionsEnabled',
'isMysqlUsedWithoutUTF8MB4',
'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed',
])->getMock();
@@ -145,11 +144,6 @@ class CheckSetupControllerTest extends TestCase {
$this->checkSetupController
->expects($this->once())
- ->method('areWebauthnExtensionsEnabled')
- ->willReturn(false);
-
- $this->checkSetupController
- ->expects($this->once())
->method('isMysqlUsedWithoutUTF8MB4')
->willReturn(false);
@@ -192,7 +186,6 @@ class CheckSetupControllerTest extends TestCase {
$expected = new DataResponse(
[
'reverseProxyDocs' => 'reverse-proxy-doc-link',
- 'areWebauthnExtensionsEnabled' => false,
'isMysqlUsedWithoutUTF8MB4' => false,
'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => true,
'reverseProxyGeneratedURL' => 'https://server/index.php',
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 678cb02bfa2..0be5ceafd36 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -188,15 +188,6 @@
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
});
}
- if (!data.areWebauthnExtensionsEnabled) {
- messages.push({
- msg: t(
- 'core',
- 'The PHP modules "gmp" and/or "bcmath" are not enabled. If you use WebAuthn passwordless authentication, these modules are required.'
- ),
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- })
- }
if (data.isMysqlUsedWithoutUTF8MB4) {
messages.push({
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
index 857156f1437..68325123efb 100644
--- a/core/js/tests/specs/setupchecksSpec.js
+++ b/core/js/tests/specs/setupchecksSpec.js
@@ -224,7 +224,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -262,7 +261,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -300,7 +298,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -339,7 +336,6 @@ describe('OC.SetupChecks tests', function() {
JSON.stringify({
isFairUseOfFreePushService: true,
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -407,7 +403,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -450,7 +445,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: true,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -490,7 +484,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
@@ -527,7 +520,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
@@ -561,7 +553,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: false,
reverseProxyGeneratedURL: 'https://server',
@@ -587,42 +578,6 @@ describe('OC.SetupChecks tests', function() {
});
});
- it('should return an error if gmp or bcmath are not enabled', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: false,
- isMysqlUsedWithoutUTF8MB4: false,
- isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
- reverseProxyGeneratedURL: 'https://server',
- temporaryDirectoryWritable: true,
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'The PHP modules "gmp" and/or "bcmath" are not enabled. If you use WebAuthn passwordless authentication, these modules are required.',
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- }]);
- done();
- });
- });
-
it('should return an info if there is no default phone region', function(done) {
var async = OC.SetupChecks.checkSetup();
@@ -633,7 +588,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -676,7 +630,6 @@ describe('OC.SetupChecks tests', function() {
},
JSON.stringify({
isFairUseOfFreePushService: true,
- areWebauthnExtensionsEnabled: true,
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',