This should be a configuration array, not a Horde_Db_Adapter object.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 13 Jan 2011 06:39:43 +0000 (01:39 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 13 Jan 2011 06:39:43 +0000 (01:39 -0500)
We shouldn't expect administrators to know how to create a custom Horde_Db_Adapter object.
Just pass the configuration array, the factory will do the rest.

turba/config/backends.php.dist
turba/lib/Driver/Sql.php

index df5b7b6..38d3044 100644 (file)
@@ -199,8 +199,18 @@ $cfgSources['localsql'] = array(
     'params' => array(
         // The default connection details are pulled from the Horde-wide SQL
         // connection configuration.
-        // To use another DB connection, you must define a Horde_Db_Adapter
-        // object here.
+        // To use another DB connection, you must provide configuration
+        // information here - for example,
+        //'sql' => array('persistent' => true,
+        //               'username' => 'horde',
+        //               'password' => 'xxx',
+        //               'socket' => '/opt/local/var/run/mysql5/mysqld.sock',
+        //               'protocol' => 'unix',
+        //               'database' => 'horde',
+        //               'charset' => 'iso-8859-1',
+        //               'ssl' => false,
+        //              'splitread' => false,
+        //               'phptype' => 'mysql'),
         'sql' => false,
         'table' => 'turba_objects'
     ),
index 5a74b12..a54ca9a 100644 (file)
@@ -52,7 +52,7 @@ class Turba_Driver_Sql extends Turba_Driver
                 throw new Turba_Exception($e);
             }
         } else {
-            $this->_db = $this->_params['sql'];
+            $this->_db = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Db')->create('turba', $this->_params['sql']);
         }
     }