Don't allow executing cli if cache backend is unavailable
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
This commit is contained in:
parent
25c24c2b6e
commit
5c868c735d
|
@ -86,35 +86,15 @@ 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 (!class_exists($localCacheClass) || !$localCacheClass::isAvailable()) {
|
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, [
|
throw new \OC\HintException(strtr($missingCacheMessage, [
|
||||||
'{class}' => $localCacheClass, '{use}' => 'local'
|
'{class}' => $localCacheClass, '{use}' => 'local'
|
||||||
]), $missingCacheHint);
|
]), $missingCacheHint);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!class_exists($distributedCacheClass) || !$distributedCacheClass::isAvailable()) {
|
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, [
|
throw new \OC\HintException(strtr($missingCacheMessage, [
|
||||||
'{class}' => $distributedCacheClass, '{use}' => 'distributed'
|
'{class}' => $distributedCacheClass, '{use}' => 'distributed'
|
||||||
]), $missingCacheHint);
|
]), $missingCacheHint);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!($lockingCacheClass && class_exists($distributedCacheClass) && $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;
|
||||||
|
|
Loading…
Reference in New Issue