From 0c346849f3904f4994ea306ef53884ffb87a2ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 12 Oct 2023 17:04:11 +0200 Subject: [PATCH 1/4] Migrate missing PHP modules check to new API and improve it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test all modules listed as required in our documentation Signed-off-by: Côme Chilliet --- .../composer/composer/autoload_classmap.php | 1 + .../composer/composer/autoload_static.php | 1 + apps/settings/lib/AppInfo/Application.php | 2 + .../lib/Controller/CheckSetupController.php | 35 ------- apps/settings/lib/SetupChecks/PhpModules.php | 95 +++++++++++++++++++ .../Controller/CheckSetupControllerTest.php | 1 - core/js/setupchecks.js | 10 -- core/js/tests/specs/setupchecksSpec.js | 25 ----- 8 files changed, 99 insertions(+), 71 deletions(-) create mode 100644 apps/settings/lib/SetupChecks/PhpModules.php diff --git a/apps/settings/composer/composer/autoload_classmap.php b/apps/settings/composer/composer/autoload_classmap.php index c6b768e8b333f..77bcc65036a45 100644 --- a/apps/settings/composer/composer/autoload_classmap.php +++ b/apps/settings/composer/composer/autoload_classmap.php @@ -78,6 +78,7 @@ 'OCA\\Settings\\SetupChecks\\InternetConnectivity' => $baseDir . '/../lib/SetupChecks/InternetConnectivity.php', 'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat' => $baseDir . '/../lib/SetupChecks/LegacySSEKeyFormat.php', 'OCA\\Settings\\SetupChecks\\PhpDefaultCharset' => $baseDir . '/../lib/SetupChecks/PhpDefaultCharset.php', + 'OCA\\Settings\\SetupChecks\\PhpModules' => $baseDir . '/../lib/SetupChecks/PhpModules.php', 'OCA\\Settings\\SetupChecks\\PhpOutdated' => $baseDir . '/../lib/SetupChecks/PhpOutdated.php', 'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => $baseDir . '/../lib/SetupChecks/PhpOutputBuffering.php', 'OCA\\Settings\\SetupChecks\\ReadOnlyConfig' => $baseDir . '/../lib/SetupChecks/ReadOnlyConfig.php', diff --git a/apps/settings/composer/composer/autoload_static.php b/apps/settings/composer/composer/autoload_static.php index 0905343597036..ea3e43da4bb33 100644 --- a/apps/settings/composer/composer/autoload_static.php +++ b/apps/settings/composer/composer/autoload_static.php @@ -93,6 +93,7 @@ class ComposerStaticInitSettings 'OCA\\Settings\\SetupChecks\\InternetConnectivity' => __DIR__ . '/..' . '/../lib/SetupChecks/InternetConnectivity.php', 'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat' => __DIR__ . '/..' . '/../lib/SetupChecks/LegacySSEKeyFormat.php', 'OCA\\Settings\\SetupChecks\\PhpDefaultCharset' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpDefaultCharset.php', + 'OCA\\Settings\\SetupChecks\\PhpModules' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpModules.php', 'OCA\\Settings\\SetupChecks\\PhpOutdated' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutdated.php', 'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutputBuffering.php', 'OCA\\Settings\\SetupChecks\\ReadOnlyConfig' => __DIR__ . '/..' . '/../lib/SetupChecks/ReadOnlyConfig.php', diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php index e6106cb9b1edd..a8660a033b803 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -53,6 +53,7 @@ use OCA\Settings\SetupChecks\InternetConnectivity; use OCA\Settings\SetupChecks\LegacySSEKeyFormat; use OCA\Settings\SetupChecks\PhpDefaultCharset; +use OCA\Settings\SetupChecks\PhpModules; use OCA\Settings\SetupChecks\PhpOutdated; use OCA\Settings\SetupChecks\PhpOutputBuffering; use OCA\Settings\SetupChecks\ReadOnlyConfig; @@ -151,6 +152,7 @@ public function register(IRegistrationContext $context): void { $context->registerSetupCheck(InternetConnectivity::class); $context->registerSetupCheck(LegacySSEKeyFormat::class); $context->registerSetupCheck(PhpDefaultCharset::class); + $context->registerSetupCheck(PhpModules::class); $context->registerSetupCheck(PhpOutdated::class); $context->registerSetupCheck(PhpOutputBuffering::class); $context->registerSetupCheck(ReadOnlyConfig::class); diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index b2da455bc1166..4748dd155ced6 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -691,40 +691,6 @@ private function getAppDirsWithDifferentOwnerForAppRoot(int $currentUser, array return $appDirsWithDifferentOwner; } - /** - * Checks for potential PHP modules that would improve the instance - * - * @return string[] A list of PHP modules that is recommended - */ - protected function hasRecommendedPHPModules(): array { - $recommendedPHPModules = []; - - if (!extension_loaded('intl')) { - $recommendedPHPModules[] = 'intl'; - } - - if (!extension_loaded('sysvsem')) { - // used to limit the usage of resources by preview generator - $recommendedPHPModules[] = 'sysvsem'; - } - - if (!extension_loaded('exif')) { - // used to extract metadata from images - // required for correct orientation of preview images - $recommendedPHPModules[] = 'exif'; - } - - if (!defined('PASSWORD_ARGON2I')) { - // Installing php-sodium on >=php7.4 will provide PASSWORD_ARGON2I - // on previous version argon2 wasn't part of the "standard" extension - // and RedHat disabled it so even installing php-sodium won't provide argon2i - // support in password_hash/password_verify. - $recommendedPHPModules[] = 'sodium'; - } - - return $recommendedPHPModules; - } - protected function isImagickEnabled(): bool { if ($this->config->getAppValue('theming', 'enabled', 'no') === 'yes') { if (!extension_loaded('imagick')) { @@ -882,7 +848,6 @@ public function check() { 'isImagickEnabled' => $this->isImagickEnabled(), 'areWebauthnExtensionsEnabled' => $this->areWebauthnExtensionsEnabled(), 'is64bit' => $this->is64bit(), - 'recommendedPHPModules' => $this->hasRecommendedPHPModules(), 'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(), 'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(), 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(), diff --git a/apps/settings/lib/SetupChecks/PhpModules.php b/apps/settings/lib/SetupChecks/PhpModules.php new file mode 100644 index 0000000000000..3f434ea6742de --- /dev/null +++ b/apps/settings/lib/SetupChecks/PhpModules.php @@ -0,0 +1,95 @@ + + * + * @author Côme Chilliet + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +namespace OCA\Settings\SetupChecks; + +use OCP\IL10N; +use OCP\SetupCheck\ISetupCheck; +use OCP\SetupCheck\SetupResult; + +class PhpModules implements ISetupCheck { + protected const REQUIRED_MODULES = [ + 'ctype', + 'curl', + 'dom', + 'fileinfo', + 'gd', + 'json', + 'mbstring', + 'openssl', + 'posix', + 'session', + 'xml', + 'xmlreader', + 'xmlwriter', + 'zip', + 'zlib', + ]; + protected const RECOMMENDED_MODULES = [ + 'intl', + 'sysvsem', + 'exif', + 'sodium', + 'bz2', + ]; + + public function __construct( + private IL10N $l10n, + ) { + } + + public function getName(): string { + return $this->l10n->t('PHP modules'); + } + + public function getCategory(): string { + return 'system'; + } + + public function run(): SetupResult { + $missingRecommendedModules = $this->getMissingModules(self::RECOMMENDED_MODULES); + $missingRequiredModules = $this->getMissingModules(self::REQUIRED_MODULES); + if (!empty($missingRequiredModules)) { + return SetupResult::error($this->l10n->t('This instance is missing some required PHP modules. It is required to install them: %s', implode(', ', $missingRequiredModules))); + } elseif (!empty($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))); + } else { + return SetupResult::success(); + } + } + + /** + * Checks for potential PHP modules that would improve the instance + * + * @param string[] $modules modules to test + * @return string[] A list of PHP modules which are missing + */ + protected function getMissingModules(array $modules): array { + return array_values(array_filter( + $modules, + fn (string $module) => !extension_loaded($module), + )); + } +} diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 449f181e8c18b..6117658c7b031 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -537,7 +537,6 @@ public function testCheck() { 'isImagickEnabled' => false, 'areWebauthnExtensionsEnabled' => false, 'is64bit' => false, - 'recommendedPHPModules' => [], 'pendingBigIntConversionColumns' => [], 'isMysqlUsedWithoutUTF8MB4' => false, 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => true, diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index a2bddefbe698d..dd77c8603c435 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -383,16 +383,6 @@ type: OC.SetupChecks.MESSAGE_TYPE_INFO }) } - if (data.recommendedPHPModules.length > 0) { - var listOfRecommendedPHPModules = ""; - data.recommendedPHPModules.forEach(function(element){ - listOfRecommendedPHPModules += '
  • ' + element + '
  • '; - }); - messages.push({ - msg: t('core', 'This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.') + '
      ' + listOfRecommendedPHPModules + '
    ', - type: OC.SetupChecks.MESSAGE_TYPE_INFO - }) - } if (!data.isImagickEnabled) { messages.push({ msg: t( diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 676111c80a4b4..dc257f9e69af2 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -252,7 +252,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -323,7 +322,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -394,7 +392,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -462,7 +459,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -528,7 +524,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -594,7 +589,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -660,7 +654,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -726,7 +719,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -794,7 +786,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -860,7 +851,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -928,7 +918,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -994,7 +983,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1060,7 +1048,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1146,7 +1133,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1219,7 +1205,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1285,7 +1270,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1351,7 +1335,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: true, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1421,7 +1404,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1488,7 +1470,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1552,7 +1533,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: false, @@ -1619,7 +1599,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: false, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1686,7 +1665,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: false, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1752,7 +1730,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: false, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1818,7 +1795,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, @@ -1891,7 +1867,6 @@ describe('OC.SetupChecks tests', function() { isImagickEnabled: true, areWebauthnExtensionsEnabled: true, is64bit: true, - recommendedPHPModules: [], pendingBigIntConversionColumns: [], isMysqlUsedWithoutUTF8MB4: false, isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, From 27995d1376ea5ae979a7bfb8cc4a25a5db1f670c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 24 Oct 2023 09:17:25 +0200 Subject: [PATCH 2/4] Add all required PHP extensions to the composer.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- composer.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e3da98e027773..c73645f575cee 100644 --- a/composer.json +++ b/composer.json @@ -23,14 +23,24 @@ }, "require": { "php": "^8.0", + "ext-ctype": "*", + "ext-curl": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-openssl": "*", "ext-pdo": "*", + "ext-posix": "*", + "ext-session": "*", "ext-simplexml": "*", + "ext-xml": "*", "ext-xmlreader": "*", - "ext-zip": "*" + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4" From d551a0d88662ae7e78308464dbdaddd5c3400c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 24 Oct 2023 15:36:09 +0200 Subject: [PATCH 3/4] Adapt CheckSetupControllerTest to the migration to a setup check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/settings/tests/Controller/CheckSetupControllerTest.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 6117658c7b031..f3759644a38b1 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -209,7 +209,6 @@ protected function setUp(): void { 'isImagickEnabled', 'areWebauthnExtensionsEnabled', 'is64bit', - 'hasRecommendedPHPModules', 'hasBigIntConversionPendingColumns', 'isMysqlUsedWithoutUTF8MB4', 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed', @@ -444,11 +443,6 @@ public function testCheck() { ->method('is64bit') ->willReturn(false); - $this->checkSetupController - ->expects($this->once()) - ->method('hasRecommendedPHPModules') - ->willReturn([]); - $this->checkSetupController ->expects($this->once()) ->method('hasBigIntConversionPendingColumns') From 424987181764792c33a03cb4351063286f6fae96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 26 Oct 2023 16:16:39 +0200 Subject: [PATCH 4/4] Add links to documentation for PHP modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/settings/lib/SetupChecks/PhpModules.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/settings/lib/SetupChecks/PhpModules.php b/apps/settings/lib/SetupChecks/PhpModules.php index 3f434ea6742de..870c2b7ada1e1 100644 --- a/apps/settings/lib/SetupChecks/PhpModules.php +++ b/apps/settings/lib/SetupChecks/PhpModules.php @@ -26,6 +26,7 @@ namespace OCA\Settings\SetupChecks; use OCP\IL10N; +use OCP\IURLGenerator; use OCP\SetupCheck\ISetupCheck; use OCP\SetupCheck\SetupResult; @@ -57,6 +58,7 @@ class PhpModules implements ISetupCheck { public function __construct( private IL10N $l10n, + private IURLGenerator $urlGenerator, ) { } @@ -72,9 +74,15 @@ public function run(): SetupResult { $missingRecommendedModules = $this->getMissingModules(self::RECOMMENDED_MODULES); $missingRequiredModules = $this->getMissingModules(self::REQUIRED_MODULES); if (!empty($missingRequiredModules)) { - return SetupResult::error($this->l10n->t('This instance is missing some required PHP modules. It is required to install them: %s', implode(', ', $missingRequiredModules))); + return SetupResult::error( + $this->l10n->t('This instance is missing some required PHP modules. It is required to install them: %s', implode(', ', $missingRequiredModules)), + $this->urlGenerator->linkToDocs('admin-php-modules') + ); } elseif (!empty($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))); + 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->urlGenerator->linkToDocs('admin-php-modules') + ); } else { return SetupResult::success(); }