return isset($conf[$type]) ? $conf[$type] : array();
}
-
- /**
- * Returns the VFS driver parameters for the specified backend.
- *
- * @param string $name The VFS system name (e.g. 'images', 'documents')
- * being used.
- *
- * @return array A hash with the VFS parameters; the VFS driver in 'type'
- * and the connection parameters in 'params'.
- * @throws Horde_Exception
- */
- static public function getVFSConfig($name)
- {
- global $conf;
-
- if ($name !== 'horde' && !isset($conf[$name]['type'])) {
- throw new Horde_Exception(_("You must configure a VFS backend."));
- }
-
- $vfs = ($name == 'horde' || $conf[$name]['type'] == 'horde')
- ? $conf['vfs']
- : $conf[$name];
-
- if ($vfs['type'] == 'sql') {
- $vfs['params'] = self::getDriverConfig($name, 'sql');
- }
-
- return $vfs;
- }
-
/**
* Checks if all necessary parameters for a driver configuration
* are set and throws a fatal error with a detailed explanation
/**
* A Horde_Injector:: based Horde_Vfs:: factory.
*
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
* @category Horde
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
* @package Core
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
/**
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
* @category Horde
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
* @package Core
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
*/
class Horde_Core_Factory_Vfs
{
* Obtain the Vfs instance.
*
* @param string $scope The vfs scope to return.
- *
+ *
* @return VFS The VFS object
*/
- public function getVfs($scope)
+ public function getVfs($scope = 'horde')
{
if (empty($this->_instances[$scope])) {
- $params = Horde::getVFSConfig($scope);
+ $params = $this->getVFSConfig($scope);
$this->_instances[$scope] = VFS::singleton($params['type'], $params['params']);
}
return $this->_instances[$scope];
}
-}
\ No newline at end of file
+ /**
+ * Returns the VFS driver parameters for the specified backend.
+ *
+ * @param string $name The VFS system name being used.
+ *
+ * @return array A hash with the VFS parameters; the VFS driver in 'type'
+ * and the connection parameters in 'params'.
+ * @throws Horde_Exception
+ */
+ public function getVFSConfig($name = 'horde')
+ {
+ global $conf;
+
+ if (($name !== 'horde') && !isset($conf[$name]['type'])) {
+ throw new Horde_Exception(_("You must configure a VFS backend."));
+ }
+
+ $vfs = ($name == 'horde' || $conf[$name]['type'] == 'horde')
+ ? $conf['vfs']
+ : $conf[$name];
+
+ if ($vfs['type'] == 'sql') {
+ $vfs['params'] = Horde::getDriverConfig($name, 'sql');
+ }
+
+ return $vfs;
+ }
+
+}
$this->_addFields($contact);
/* List files. */
- $v_params = Horde::getVFSConfig('documents');
+ $v_params = $GLOBALS['injector']->getInstance('Horde_Vfs')->getConfig('documents');
if ($v_params['type'] != 'none') {
$files = $contact->listFiles();
if (is_a($files, 'PEAR_Error')) {