diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-01-15 16:45:19 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-01-18 09:40:43 +0100 |
commit | 5ad549a72f54ce36bc9cb78e4dbdea657cfd3adf (patch) | |
tree | adb2207f489e2d72a86e9ae70876cacf3f9ce852 /apps/settings/lib/SetupChecks/MemcacheConfigured.php | |
parent | a9ba1fe7e1bec82bd6c940743c7bacb6af4212ef (diff) | |
download | nextcloud-server-5ad549a72f54ce36bc9cb78e4dbdea657cfd3adf.tar.gz nextcloud-server-5ad549a72f54ce36bc9cb78e4dbdea657cfd3adf.zip |
Migrate memcached PHP module setup check to new API
Merged it with the other existing memcache setup check as it fits
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/settings/lib/SetupChecks/MemcacheConfigured.php')
-rw-r--r-- | apps/settings/lib/SetupChecks/MemcacheConfigured.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/apps/settings/lib/SetupChecks/MemcacheConfigured.php b/apps/settings/lib/SetupChecks/MemcacheConfigured.php index 2cde18a25df..1afe9cb879c 100644 --- a/apps/settings/lib/SetupChecks/MemcacheConfigured.php +++ b/apps/settings/lib/SetupChecks/MemcacheConfigured.php @@ -48,13 +48,29 @@ class MemcacheConfigured implements ISetupCheck { } public function run(): SetupResult { - if ($this->config->getSystemValue('memcache.local', null) !== null) { - return SetupResult::success($this->l10n->t('Configured')); - } else { + $memcacheDistributedClass = $this->config->getSystemValue('memcache.distributed', null); + $memcacheLockingClass = $this->config->getSystemValue('memcache.locking', null); + $memcacheLocalClass = $this->config->getSystemValue('memcache.local', null); + $caches = array_filter([$memcacheDistributedClass,$memcacheLockingClass,$memcacheLocalClass]); + if (in_array(\OC\Memcache\Memcached::class, array_map(fn (string $class) => ltrim($class, '\\'), $caches))) { + if (extension_loaded('memcache')) { + return SetupResult::warning( + $this->l10n->t('Memcached is configured as distributed cache, but the wrong PHP module "memcache" is installed. \\OC\\Memcache\\Memcached only supports "memcached" and not "memcache".'), + 'https://code.google.com/p/memcached/wiki/PHPClientComparison' + ); + } + if (!extension_loaded('memcached')) { + return SetupResult::warning( + $this->l10n->t('Memcached is configured as distributed cache, but the PHP module "memcached" is not installed.') + ); + } + } + if ($memcacheLocalClass === null) { return SetupResult::info( $this->l10n->t('No memory cache has been configured. To enhance performance, please configure a memcache, if available.'), $this->urlGenerator->linkToDocs('admin-performance') ); } + return SetupResult::success($this->l10n->t('Configured')); } } |