summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-06-09 15:22:33 +0200
committerVincent Petry <pvince81@owncloud.com>2015-06-12 12:33:06 +0200
commit3b08b2658954b95932af8eec7cfaac17b1da7873 (patch)
tree6df71b8ae97559b0781c4f5cc9bc267764a97393 /lib/private
parentdbe344ef3dc3ea643513fce8d76d1979d733c49a (diff)
downloadnextcloud-server-3b08b2658954b95932af8eec7cfaac17b1da7873.tar.gz
nextcloud-server-3b08b2658954b95932af8eec7cfaac17b1da7873.zip
Throw exception if memcache misconfigured or missing
Instead of falling back to null memcache, throw exceptions. Also throw file locking specific exceptions in case the class is not available.
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/memcache/factory.php17
-rw-r--r--lib/private/server.php4
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/private/memcache/factory.php b/lib/private/memcache/factory.php
index 5e3d857006c..320657a71ad 100644
--- a/lib/private/memcache/factory.php
+++ b/lib/private/memcache/factory.php
@@ -62,12 +62,25 @@ class Factory implements ICacheFactory {
{
$this->globalPrefix = $globalPrefix;
- if (!($localCacheClass && $localCacheClass::isAvailable())) {
+ if (!$localCacheClass) {
$localCacheClass = self::NULL_CACHE;
}
- if (!($distributedCacheClass && $distributedCacheClass::isAvailable())) {
+ if (!$distributedCacheClass) {
$distributedCacheClass = $localCacheClass;
}
+
+ if (!$localCacheClass::isAvailable()) {
+ throw new \OC\HintException(
+ 'Missing memcache class ' . $localCacheClass . ' for local cache',
+ 'Is the matching PHP module installed and enabled ?'
+ );
+ }
+ if (!$distributedCacheClass::isAvailable()) {
+ throw new \OC\HintException(
+ 'Missing memcache class ' . $distributedCacheClass . ' for distributed cache',
+ 'Is the matching PHP module installed and enabled ?'
+ );
+ }
if (!($lockingCacheClass && $lockingCacheClass::isAvailable())) {
// dont fallback since the fallback might not be suitable for storing lock
$lockingCacheClass = '\OC\Memcache\NullCache';
diff --git a/lib/private/server.php b/lib/private/server.php
index 5ed9d78f41b..ef033eb389d 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -431,6 +431,10 @@ class Server extends SimpleContainer implements IServerContainer {
if (!($memcache instanceof \OC\Memcache\NullCache)) {
return new MemcacheLockingProvider($memcache);
}
+ throw new HintException(
+ 'File locking is enabled but the locking cache class was not found',
+ 'Please check the "memcache.locking" setting and make sure the matching PHP module is installed and enabled'
+ );
}
return new NoopLockingProvider();
});