Merge pull request #14992 from owncloud/add-exception-to-memcachbe

Use ArrayCache if ownCloud is not installed
This commit is contained in:
Morris Jobke 2015-03-18 14:56:43 +01:00
commit 917145e027
1 changed files with 19 additions and 10 deletions

View File

@ -12,6 +12,7 @@ use OC\Diagnostics\NullQueryLogger;
use OC\Diagnostics\EventLogger; use OC\Diagnostics\EventLogger;
use OC\Diagnostics\QueryLogger; use OC\Diagnostics\QueryLogger;
use OC\Mail\Mailer; use OC\Mail\Mailer;
use OC\Memcache\ArrayCache;
use OC\Security\CertificateManager; use OC\Security\CertificateManager;
use OC\Files\Node\Root; use OC\Files\Node\Root;
use OC\Files\View; use OC\Files\View;
@ -159,17 +160,25 @@ class Server extends SimpleContainer implements IServerContainer {
$this->registerService('UserCache', function ($c) { $this->registerService('UserCache', function ($c) {
return new UserCache(); return new UserCache();
}); });
$this->registerService('MemCacheFactory', function ($c) { $this->registerService('MemCacheFactory', function (Server $c) {
$config = $c->getConfig(); $config = $c->getConfig();
$v = \OC_App::getAppVersions();
$v['core'] = implode('.', \OC_Util::getVersion()); if($config->getSystemValue('installed', false)) {
$version = implode(',', $v); $v = \OC_App::getAppVersions();
$instanceId = \OC_Util::getInstanceId(); $v['core'] = implode('.', \OC_Util::getVersion());
$path = \OC::$SERVERROOT; $version = implode(',', $v);
$prefix = md5($instanceId.'-'.$version.'-'.$path); $instanceId = \OC_Util::getInstanceId();
return new \OC\Memcache\Factory($prefix, $path = \OC::$SERVERROOT;
$config->getSystemValue('memcache.local', null), $prefix = md5($instanceId.'-'.$version.'-'.$path);
$config->getSystemValue('memcache.distributed', null) 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) { $this->registerService('ActivityManager', function ($c) {