diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-06-04 09:42:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-04 09:42:24 +0200 |
commit | 21455faf36e94233fddb33dd481836cb45e447ff (patch) | |
tree | 6719afbb30aba5980db3e4e527a8ea33c725e6fb /lib | |
parent | dcec4b00f833fb1849bc8d649c2818298710b3cd (diff) | |
parent | 5c868c735dc497b2839924fe440359f1905ed78f (diff) | |
download | nextcloud-server-21455faf36e94233fddb33dd481836cb45e447ff.tar.gz nextcloud-server-21455faf36e94233fddb33dd481836cb45e447ff.zip |
Merge pull request #27334 from nextcloud/backport/25770/stable21
[stable21] Don't allow executing cli if cache backend is unavailable
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Memcache/Factory.php | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php index 6db9b1007ac..0e1fc2f80c1 100644 --- a/lib/private/Memcache/Factory.php +++ b/lib/private/Memcache/Factory.php @@ -86,34 +86,14 @@ class Factory implements ICacheFactory { $missingCacheMessage = 'Memcache {class} not available for {use} cache'; $missingCacheHint = 'Is the matching PHP module installed and enabled?'; if (!class_exists($localCacheClass) || !$localCacheClass::isAvailable()) { - if (\OC::$CLI && !defined('PHPUNIT_RUN')) { - // CLI should not hard-fail on broken memcache - $this->logger->info($missingCacheMessage, [ - 'class' => $localCacheClass, - 'use' => 'local', - 'app' => 'cli' - ]); - $localCacheClass = self::NULL_CACHE; - } else { - throw new \OC\HintException(strtr($missingCacheMessage, [ - '{class}' => $localCacheClass, '{use}' => 'local' - ]), $missingCacheHint); - } + throw new \OC\HintException(strtr($missingCacheMessage, [ + '{class}' => $localCacheClass, '{use}' => 'local' + ]), $missingCacheHint); } if (!class_exists($distributedCacheClass) || !$distributedCacheClass::isAvailable()) { - if (\OC::$CLI && !defined('PHPUNIT_RUN')) { - // CLI should not hard-fail on broken memcache - $this->logger->info($missingCacheMessage, [ - 'class' => $distributedCacheClass, - 'use' => 'distributed', - 'app' => 'cli' - ]); - $distributedCacheClass = self::NULL_CACHE; - } else { - throw new \OC\HintException(strtr($missingCacheMessage, [ - '{class}' => $distributedCacheClass, '{use}' => 'distributed' - ]), $missingCacheHint); - } + throw new \OC\HintException(strtr($missingCacheMessage, [ + '{class}' => $distributedCacheClass, '{use}' => 'distributed' + ]), $missingCacheHint); } if (!($lockingCacheClass && class_exists($distributedCacheClass) && $lockingCacheClass::isAvailable())) { // don't fallback since the fallback might not be suitable for storing lock |