{
$CONTENT_DIR = dirname(__FILE__) . '/../';
- $GLOBALS['conf']['sql']['adapter'] = $GLOBALS['conf']['sql']['phptype'] == 'mysqli' ? 'mysqli' : 'pdo_' . $GLOBALS['conf']['sql']['phptype'];
-
- // @TODO use this
- // $injector = new Horde_Injector();
-
- $this->db = Horde_Db_Adapter::factory($GLOBALS['conf']['sql']);
+ $this->db = $GLOBALS['injector']->getInstance('db-writer');
$context = array('dbAdapter' => $this->db);
$this->typeManager = new Content_Types_Manager($context);
$this->tagger = new Content_Tagger($context);
}
-
}
define('HORDE_BASE', '/var/www/html/horde');
$horde_authentication = 'none';
require_once HORDE_BASE . '/lib/base.php';
-$GLOBALS['conf']['sql']['adapter'] = $GLOBALS['conf']['sql']['phptype'] == 'mysqli' ? 'mysqli' : 'pdo_' . $GLOBALS['conf']['sql']['phptype'];
-$db = Horde_Db_Adapter::factory($GLOBALS['conf']['sql']);
+$db = $GLOBALS['injector']->getInstance('db-writer');
// Putting these here so they don't interfere with timing/memory data when
// profiling.
public function getAdapter()
{
- return Horde_Db_Adapter::factory($GLOBALS['conf']['sql']);
+ return $GLOBALS['injector']->getInstance('db-writer');
}
}
public function getAdapter()
{
- return Horde_Db_Adapter::factory($GLOBALS['conf']['sql']);
+ return $GLOBALS['injector']->getInstance('db-writer');
}
}
new Horde_Application(array('authentication' => 'none'));
// Get a database connection
-$GLOBALS['conf']['sql']['adapter'] = $GLOBALS['conf']['sql']['phptype'] == 'mysqli' ? 'mysqli' : 'pdo_' . $GLOBALS['conf']['sql']['phptype'];
-$db = Horde_Db_Adapter::factory($GLOBALS['conf']['sql']);
+$db = $GLOBALS['injector']->getInstance('db-manager');
// Parse command line arguments
array_shift($_SERVER['argv']);
}
// Set up the context for the tagger and related content classes
- $GLOBALS['conf']['sql']['adapter'] = $GLOBALS['conf']['sql']['phptype'] == 'mysqli'
- ? 'mysqli'
- : 'pdo_' . $GLOBALS['conf']['sql']['phptype'];
- if (!empty($GLOBALS['conf']['sql']['params']['hostspec'])) {
- $GLOBALS['conf']['sql']['params']['host'] = $GLOBALS['conf']['sql']['params']['hostspec'];
- }
-
- $context = array('dbAdapter' => Horde_Db_Adapter::factory($GLOBALS['conf']['sql']));
+ $context = array('dbAdapter' => $GLOBALS['injector']->getInstance('db-writer'));
$user_mgr = new Content_Users_Manager($context);
$type_mgr = new Content_Types_Manager($context);