diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-03-18 11:47:16 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-03-18 11:47:16 +0100 |
commit | 917cb66a5b8871c47a4c043cb326aea21b9f1407 (patch) | |
tree | e7d193f43682c84834f7bed303c8be755bab64a6 /lib/private/server.php | |
parent | 8a95bf18b7f870541089ad51764baa8679579e4c (diff) | |
download | nextcloud-server-917cb66a5b8871c47a4c043cb326aea21b9f1407.tar.gz nextcloud-server-917cb66a5b8871c47a4c043cb326aea21b9f1407.zip |
Use ArrayCache if ownCloud is not installed
If ownCloud has not been installed yet the prefix might otherwise change at this point quite some time and thus the cache runs havoc.
This made installing ownCloud impossible on systems where APCu or so was available. However, I was not able to reproduce the same problem for application upgrades so this patch seems to work fine for this situation as well.
Fixes itself.
Diffstat (limited to 'lib/private/server.php')
-rw-r--r-- | lib/private/server.php | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index c55817bb6b3..4264c70905c 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -12,6 +12,7 @@ use OC\Diagnostics\NullQueryLogger; use OC\Diagnostics\EventLogger; use OC\Diagnostics\QueryLogger; use OC\Mail\Mailer; +use OC\Memcache\ArrayCache; use OC\Security\CertificateManager; use OC\Files\Node\Root; use OC\Files\View; @@ -159,17 +160,25 @@ class Server extends SimpleContainer implements IServerContainer { $this->registerService('UserCache', function ($c) { return new UserCache(); }); - $this->registerService('MemCacheFactory', function ($c) { + $this->registerService('MemCacheFactory', function (Server $c) { $config = $c->getConfig(); - $v = \OC_App::getAppVersions(); - $v['core'] = implode('.', \OC_Util::getVersion()); - $version = implode(',', $v); - $instanceId = \OC_Util::getInstanceId(); - $path = \OC::$SERVERROOT; - $prefix = md5($instanceId.'-'.$version.'-'.$path); - return new \OC\Memcache\Factory($prefix, - $config->getSystemValue('memcache.local', null), - $config->getSystemValue('memcache.distributed', null) + + if($config->getSystemValue('installed', false)) { + $v = \OC_App::getAppVersions(); + $v['core'] = implode('.', \OC_Util::getVersion()); + $version = implode(',', $v); + $instanceId = \OC_Util::getInstanceId(); + $path = \OC::$SERVERROOT; + $prefix = md5($instanceId.'-'.$version.'-'.$path); + return new \OC\Memcache\Factory($prefix, + $config->getSystemValue('memcache.local', null), + $config->getSystemValue('memcache.distributed', null) + ); + } + + return new \OC\Memcache\Factory('', + new ArrayCache(), + new ArrayCache() ); }); $this->registerService('ActivityManager', function ($c) { |