/usr/share/horde/whups/lib/Factory/Driver.php is in php-horde-whups 3.0.0~beta1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | <?php
/**
* Horde_Injector based factory for Kronolith_Driver
*/
class Whups_Factory_Driver extends Horde_Core_Factory_Base
{
/**
* Instances.
*
* @var array
*/
private $_instances = array();
/**
* Return the driver instance.
*
* @param string $driver The storage backend to use
* @param array $params Driver params
*
* @return Kronolith_Driver
* @throws Kronolith_Exception
*/
public function create($driver = null, $params = array())
{
if (is_null($driver)) {
$driver = $GLOBALS['conf']['tickets']['driver'];
}
if (!empty($this->_instances[$driver])) {
return $this->_instances[$driver];
}
$driver = basename($driver);
$class = 'Whups_Driver_' . $driver;
if (class_exists($class)) {
if (is_null($params)) {
$params = Horde::getDriverConfig('tickets', $driver);
}
$this->_instances[$driver] = new $class($params);
switch ($driver) {
case 'Sql':
$this->_instances[$driver]
->setStorage($GLOBALS['injector']->getInstance('Horde_Core_Factory_Db')->create('whups', 'tickets'));
}
return $this->_instances[$driver];
} else {
throw new Whups_Exception(sprintf('No such backend "%s" found', $driver));
}
}
}
|