Skip to content

Commit

Permalink
Merge pull request #31470 from nextcloud/enh/13099/allow-disable-imag…
Browse files Browse the repository at this point in the history
…ick-warning
  • Loading branch information
skjnldsv authored Mar 8, 2022
2 parents 697e1d6 + 3c8f8bc commit 23e8ae1
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 14 deletions.
35 changes: 21 additions & 14 deletions apps/settings/lib/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,20 +714,6 @@ protected function hasRecommendedPHPModules(): array {
$recommendedPHPModules[] = 'intl';
}

if (!extension_loaded('bcmath')) {
$recommendedPHPModules[] = 'bcmath';
}

if (!extension_loaded('gmp')) {
$recommendedPHPModules[] = 'gmp';
}

if ($this->config->getAppValue('theming', 'enabled', 'no') === 'yes') {
if (!extension_loaded('imagick')) {
$recommendedPHPModules[] = 'imagick';
}
}

if (!defined('PASSWORD_ARGON2I') && PHP_VERSION_ID >= 70400) {
// Installing php-sodium on >=php7.4 will provide PASSWORD_ARGON2I
// on previous version argon2 wasn't part of the "standard" extension
Expand All @@ -739,6 +725,25 @@ protected function hasRecommendedPHPModules(): array {
return $recommendedPHPModules;
}

protected function isImagickEnabled(): bool {
if ($this->config->getAppValue('theming', 'enabled', 'no') === 'yes') {
if (!extension_loaded('imagick')) {
return false;
}
}
return true;
}

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);
}
Expand Down Expand Up @@ -870,6 +875,8 @@ public function check() {
'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'),
'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(),
'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(),
'isImagickEnabled' => $this->isImagickEnabled(),
'areWebauthnExtensionsEnabled' => $this->areWebauthnExtensionsEnabled(),
'recommendedPHPModules' => $this->hasRecommendedPHPModules(),
'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(),
'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(),
Expand Down
12 changes: 12 additions & 0 deletions apps/settings/tests/Controller/CheckSetupControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,16 @@ public function testCheck() {
->method('getAppDirsWithDifferentOwner')
->willReturn([]);

$this->checkSetupController
->expects($this->once())
->method('isImagickEnabled')
->willReturn(false);

$this->checkSetupController
->expects($this->once())
->method('areWebauthnExtensionsEnabled')
->willReturn(false);

$this->checkSetupController
->expects($this->once())
->method('hasRecommendedPHPModules')
Expand Down Expand Up @@ -642,6 +652,8 @@ public function testCheck() {
'missingColumns' => [],
'isMemoryLimitSufficient' => true,
'appDirsWithDifferentOwner' => [],
'isImagickEnabled' => false,
'areWebauthnExtensionsEnabled' => false,
'recommendedPHPModules' => [],
'pendingBigIntConversionColumns' => [],
'isMysqlUsedWithoutUTF8MB4' => false,
Expand Down
18 changes: 18 additions & 0 deletions core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,24 @@
type: OC.SetupChecks.MESSAGE_TYPE_INFO
})
}
if (!data.isImagickEnabled) {
messages.push({
msg: t(
'core',
'The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.'
),
type: OC.SetupChecks.MESSAGE_TYPE_INFO
})
}
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.imageMagickLacksSVGSupport) {
messages.push({
msg: t(
Expand Down
Loading

0 comments on commit 23e8ae1

Please sign in to comment.