diff --git a/lib/base.php b/lib/base.php index 53ea28b46b..83417c52a5 100644 --- a/lib/base.php +++ b/lib/base.php @@ -371,11 +371,6 @@ class OC { // register autoloader require_once __DIR__ . '/autoloader.php'; self::$loader = new \OC\Autoloader(); - spl_autoload_register(array(self::$loader, 'load')); - try { - self::$loader->setMemoryCache(\OC\Memcache\Factory::createLowLatency('Autoloader')); - } catch(\Exception $ex) { - } self::$loader->registerPrefix('Doctrine\\Common', 'doctrine/common/lib'); self::$loader->registerPrefix('Doctrine\\DBAL', 'doctrine/dbal/lib'); self::$loader->registerPrefix('Symfony\\Component\\Routing', 'symfony/routing'); @@ -383,6 +378,7 @@ class OC { self::$loader->registerPrefix('Sabre\\VObject', '3rdparty'); self::$loader->registerPrefix('Sabre_', '3rdparty'); self::$loader->registerPrefix('Patchwork', '3rdparty'); + spl_autoload_register(array(self::$loader, 'load')); // set some stuff //ob_start(); @@ -438,6 +434,14 @@ class OC { } self::initPaths(); + if (OC_Config::getValue('instanceid', false)) { + // \OC\Memcache\Cache has a hidden dependency on + // OC_Util::getInstanceId() for namespacing. See #5409. + try { + self::$loader->setMemoryCache(\OC\Memcache\Factory::createLowLatency('Autoloader')); + } catch(\Exception $ex) { + } + } OC_Util::isSetLocaleWorking(); // set debug mode if an xdebug session is active