Make sure old instances don't break

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-01-05 11:57:18 +01:00
parent bf043deba3
commit 57c65c3ec6
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ class Factory implements ICacheFactory {
$missingCacheMessage = 'Memcache {class} not available for {use} cache'; $missingCacheMessage = 'Memcache {class} not available for {use} cache';
$missingCacheHint = 'Is the matching PHP module installed and enabled?'; $missingCacheHint = 'Is the matching PHP module installed and enabled?';
if (!$localCacheClass::isAvailable()) { if (!class_exists($localCacheClass) || !$localCacheClass::isAvailable()) {
if (\OC::$CLI && !defined('PHPUNIT_RUN')) { if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
// CLI should not hard-fail on broken memcache // CLI should not hard-fail on broken memcache
$this->logger->info($missingCacheMessage, [ $this->logger->info($missingCacheMessage, [
@ -98,7 +98,7 @@ class Factory implements ICacheFactory {
]), $missingCacheHint); ]), $missingCacheHint);
} }
} }
if (!$distributedCacheClass::isAvailable()) { if (!class_exists($distributedCacheClass) || !$distributedCacheClass::isAvailable()) {
if (\OC::$CLI && !defined('PHPUNIT_RUN')) { if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
// CLI should not hard-fail on broken memcache // CLI should not hard-fail on broken memcache
$this->logger->info($missingCacheMessage, [ $this->logger->info($missingCacheMessage, [
@ -113,7 +113,7 @@ class Factory implements ICacheFactory {
]), $missingCacheHint); ]), $missingCacheHint);
} }
} }
if (!($lockingCacheClass && $lockingCacheClass::isAvailable())) { if (!($lockingCacheClass && class_exists($distributedCacheClass) && $lockingCacheClass::isAvailable())) {
// don't fallback since the fallback might not be suitable for storing lock // don't fallback since the fallback might not be suitable for storing lock
$lockingCacheClass = self::NULL_CACHE; $lockingCacheClass = self::NULL_CACHE;
} }