summaryrefslogtreecommitdiffstats
path: root/lib/private/server.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-05-21 16:11:10 +0200
committerRobin Appelman <icewind@owncloud.com>2015-06-01 13:22:56 +0200
commit2f4f468399d316157979f747d2418fb5cff8d3e0 (patch)
treea29a1e0b6d5438c4e2c178f24ea0788fdbcc8829 /lib/private/server.php
parentc72ea9f7d72d3ab22ff56195235808b17cecb0ba (diff)
downloadnextcloud-server-2f4f468399d316157979f747d2418fb5cff8d3e0.tar.gz
nextcloud-server-2f4f468399d316157979f747d2418fb5cff8d3e0.zip
Added config switch for file locking
Diffstat (limited to 'lib/private/server.php')
-rw-r--r--lib/private/server.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/private/server.php b/lib/private/server.php
index 900d754012c..88f57e73a39 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -44,6 +44,7 @@ use OC\Diagnostics\NullQueryLogger;
use OC\Diagnostics\EventLogger;
use OC\Diagnostics\QueryLogger;
use OC\Lock\MemcacheLockingProvider;
+use OC\Lock\NoopLockingProvider;
use OC\Mail\Mailer;
use OC\Memcache\ArrayCache;
use OC\Http\Client\ClientService;
@@ -422,11 +423,15 @@ class Server extends SimpleContainer implements IServerContainer {
);
});
$this->registerService('LockingProvider', function (Server $c) {
- /** @var \OC\Memcache\Factory $memcacheFactory */
- $memcacheFactory = $c->getMemCacheFactory();
- return new MemcacheLockingProvider(
- $memcacheFactory->createDistributed('lock')
- );
+ if ($c->getConfig()->getSystemValue('filelocking.enabled', false)) {
+ /** @var \OC\Memcache\Factory $memcacheFactory */
+ $memcacheFactory = $c->getMemCacheFactory();
+ $memcache = $memcacheFactory->createDistributed('lock');
+ if (!($memcache instanceof \OC\Memcache\Null)) {
+ return new MemcacheLockingProvider($memcache);
+ }
+ }
+ return new NoopLockingProvider();
});
}