From 11f9a71f683482c81eaf9e6cef7110534e9bb541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 25 Feb 2022 12:23:54 +0000 Subject: [PATCH] WIP: Stop recommending imagemagick in the admin pages This tempts admins into installing insecure packages to make the warning go away, even going so far as to [impurely modify running containers](https://github.com/nextcloud/docker/issues/1414#issuecomment-1008915705). Changing the warning to trigger if the php-imagick module is loaded is more in line with the actual upstream recommendation, and hopefully helps unsuspecting users who have hacked around the warning in the past realize this. Draft because: - [ ] Untested (will try building this all this evening) - [ ] Translations are missing Band-aid for #1414, while we wait for a proper solution with libvips or somesuch. --- apps/settings/lib/Controller/CheckSetupController.php | 4 ++-- core/js/setupchecks.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 11900fad45b9e..5679e78671d38 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -815,8 +815,8 @@ protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool { return false; } - protected function imageMagickLacksSVGSupport(): bool { - return extension_loaded('imagick') && count(\Imagick::queryFormats('SVG')) === 0; + protected function imageMagickLoaded(): bool { + return extension_loaded('imagick'); } /** diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index fdeed4897d091..6441c95532413 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -424,13 +424,13 @@ type: OC.SetupChecks.MESSAGE_TYPE_INFO }) } - if (data.imageMagickLacksSVGSupport) { + if (data.imageMagickLoaded) { messages.push({ msg: t( 'core', - 'Module php-imagick in this instance has no SVG support. For better compatibility it is recommended to install it.' - ), - type: OC.SetupChecks.MESSAGE_TYPE_INFO + 'Imagemagick is in use for document preview. This is not recommended out of security concerns, see the document preview documentation here:' + ) + " https://docs.nextcloud.com/server/stable/admin_manual/configuration_files/previews_configuration.html", + type: OC.SetupChecks.MESSAGE_TYPE_WARNING }) } if (data.pendingBigIntConversionColumns.length > 0) {