aboutsummaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php
index be0955090e0..e8565749425 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -477,9 +477,18 @@ class OC {
self::handleAuthHeaders();
self::initPaths();
- if (OC_Config::getValue('instanceid', false)) {
+
+ // The class loader takes an optional low-latency cache, which MUST be
+ // namespaced. The instanceid is used for namespacing, but might be
+ // unavailable at this point. Futhermore, it might not be possible to
+ // generate an instanceid via \OC_Util::getInstanceId() because the
+ // config file may not be writable. As such, we only register a class
+ // loader cache if instanceid is available without trying to create one.
+ $instanceId = OC_Config::getValue('instanceid', null);
+ if ($instanceId) {
try {
- self::$loader->setMemoryCache(\OC\Memcache\Factory::createLowLatency('Autoloader'));
+ $memcacheFactory = new \OC\Memcache\Factory($instanceId);
+ self::$loader->setMemoryCache($memcacheFactory->createLowLatency('Autoloader'));
} catch (\Exception $ex) {
}
}