diff --git a/framework/Core/lib/Horde/Core/Factory/Db.php b/framework/Core/lib/Horde/Core/Factory/Db.php index dded252d38c..a14e0c0fddb 100644 --- a/framework/Core/lib/Horde/Core/Factory/Db.php +++ b/framework/Core/lib/Horde/Core/Factory/Db.php @@ -99,7 +99,14 @@ public function create($app = 'horde', $backend = null) $this->_instances[$sig] = $this->create(); } elseif (!isset($this->_instances[$sig])) { try { - $this->_instances[$sig] = $this->createDb($config); + $this->_instances[$sig] = $this->_createDb($config); + if (!isset($config['cache'])) { + /* Need to add cache ob here, instead of createDb, or else + * we enter infinite bootstrapping loop. Bug #13439 */ + $this->_instances[$sig]->setCache( + $this->_injector->getInstance('Horde_Cache') + ); + } } catch (Horde_Exception $e) {} } @@ -124,14 +131,25 @@ public function getConfig($backend) /** */ public function createDb($config) + { + $ob = $this->_createDb($config); + if (!isset($config['cache'])) { + $ob->setCache($this->_injector->getInstance('Horde_Cache')); + } + return $ob; + } + + /** + */ + protected function _createDb($config) { // Split read? if (!empty($config['splitread'])) { $read_config = $config['read']; unset($config['read'], $config['splitread']); return new Horde_Db_Adapter_SplitRead( - $this->createDb(array_merge($config, $read_config)), - $this->createDb($config) + $this->_createDb(array_merge($config, $read_config)), + $this->_createDb($config) ); } @@ -169,28 +187,11 @@ public function createDb($config) $ob = new $class($config); - if (!isset($config['cache'])) { - $cacheFactory = $this->_injector->getInstance('Horde_Core_Factory_Cache'); - - switch ($cacheFactory->getDriverName()) { - case 'sql': - $injector = $this->_injector->createChildInjector(); - $injector->setInstance('Horde_Db_Adapter', $ob); - $cache = $cacheFactory->create($injector); - break; - - default: - $cache = $this->_injector->getInstance('Horde_Cache'); - break; - } - - $ob->setCache($cache); - } - if (!isset($config['logger'])) { $ob->setLogger($this->_injector->getInstance('Horde_Log_Logger')); } return $ob; } + } diff --git a/framework/Core/package.xml b/framework/Core/package.xml index 580ea7597c7..a4e21f1c93a 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -39,6 +39,7 @@ LGPL-2.1 +* [mms] Fix boostrapping DB object when using SQL as the Horde cache driver (Bug #13439). * [mjr] Support ITEMOPERATIONS_EMPTYFOLDER requests via ActiveSync. * [mjr] Fetch correct data for EAS ItemSettings requests. * [jan] Catch exception from application in portal block (Bug #13427). @@ -3603,6 +3604,7 @@ 2014-08-04 LGPL-2.1 +* [mms] Fix boostrapping DB object when using SQL as the Horde cache driver (Bug #13439). * [mjr] Support ITEMOPERATIONS_EMPTYFOLDER requests via ActiveSync. * [mjr] Fetch correct data for EAS ItemSettings requests. * [jan] Catch exception from application in portal block (Bug #13427).