From fb8207ce940d5a65d58f8cc79ff9d0db2c995174 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 3 Aug 2010 00:44:01 -0600 Subject: [PATCH] Allow a configuration to be passed to Horde_Db factory. --- framework/Core/lib/Horde/Core/Factory/Db.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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']) && -- 2.11.0