diff --git a/turba/lib/Application.php b/turba/lib/Application.php index 41cd8dc4ba4..4e9833cf43a 100644 --- a/turba/lib/Application.php +++ b/turba/lib/Application.php @@ -426,7 +426,6 @@ public function topbarCreate(Horde_Tree_Renderer_Base $tree, $parent = null, /* Download data. */ /** - * @throws Horde_Vfs_Exception * @throws Turba_Exception * @throws Horde_Exception_NotFound */ @@ -448,7 +447,12 @@ public function download(Horde_Variables $vars) throw new Turba_Exception(_("You do not have permission to view this contact.")); } - $vfs = $injector->getInstance('Horde_Core_Factory_Vfs')->create('documents'); + try { + $vfs = $injector->getInstance('Horde_Core_Factory_Vfs')->create('documents'); + } catch (Horde_Vfs_Exception $e) { + throw new Turba_Exception(_("Data cannot be downloaded as no VFS driver is configured.")); + } + try { return array( 'data' => $vfs->read(Turba::VFS_PATH . '/' . $object->getValue('__uid'), $vars->file), diff --git a/turba/lib/Form/Contact.php b/turba/lib/Form/Contact.php index 280799f09ad..45cfaeab310 100644 --- a/turba/lib/Form/Contact.php +++ b/turba/lib/Form/Contact.php @@ -30,15 +30,17 @@ public function __construct($vars, Turba_Object $contact, $tabs = true, $title = $this->_addFields($contact, $tabs); /* List files. */ - $v_params = $injector->getInstance('Horde_Core_Factory_Vfs')->getConfig('documents'); - if ($v_params['type'] != 'none') { - try { - $files = $contact->listFiles(); - $this->addVariable(_("Files"), '__vfs', 'html', false); - $vars->set('__vfs', implode('
', array_map(array($contact, 'vfsEditUrl'), $files))); - } catch (Turba_Exception $e) { - $notification->push($files, 'horde.error'); - } + try { + /* This throws Horde_Exception if VFS not available. */ + $injector->getInstance('Horde_Core_Factory_Vfs')->create('documents'); + + $files = $contact->listFiles(); + $this->addVariable(_("Files"), '__vfs', 'html', false); + $vars->set('__vfs', implode('
', array_map(array($contact, 'vfsEditUrl'), $files))); + } catch (Turba_Exception $e) { + $notification->push($files, 'horde.error'); + } catch (Horde_Exception $e) { + /* Ignore: VFS is not active. */ } }