From: Michael M Slusarz Date: Tue, 3 Aug 2010 06:44:01 +0000 (-0600) Subject: Allow a configuration to be passed to Horde_Db factory. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fb8207ce940d5a65d58f8cc79ff9d0db2c995174;p=horde.git Allow a configuration to be passed to Horde_Db factory. --- diff --git a/framework/Core/lib/Horde/Core/Factory/Db.php b/framework/Core/lib/Horde/Core/Factory/Db.php index 5cf05bced..dc00a6f77 100644 --- a/framework/Core/lib/Horde/Core/Factory/Db.php +++ b/framework/Core/lib/Horde/Core/Factory/Db.php @@ -56,8 +56,9 @@ class Horde_Core_Factory_Db /** * Return the DB instance. * - * @param string $app The application. - * @param string $type The type. + * @param string $app The application. + * @param mixed $type The type. If this is an array, this is used as + * the configuration array. * * @return Horde_Db_Adapter_Base The singleton instance. * @throws Horde_Exception @@ -65,7 +66,7 @@ class Horde_Core_Factory_Db */ public function getDb($app = 'horde', $type = null) { - $sig = $app . '|' . $type; + $sig = hash('md5', serialize($app . '|' . $type)); if (isset($this->_instances[$sig])) { return $this->_instances[$sig]; @@ -75,7 +76,9 @@ class Horde_Core_Factory_Db ? false : $GLOBALS['registry']->pushApp($app); - $config = Horde::getDriverConfig($type, 'sql'); + $config = is_array($type) + ? $type + : $this->getConfig($type); /* Determine if we are using the base SQL config. */ if (isset($config['driverconfig']) &&