From d3bb9ce6edca29da714c945b361e75597388926d Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sat, 24 Oct 2009 14:51:30 -0400 Subject: [PATCH] MFB: Catch errors from incorrectly configured VFS. Bug: 7741 --- turba/lib/Object.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/turba/lib/Object.php b/turba/lib/Object.php index 06f9d772e..1ae8b2bbe 100644 --- a/turba/lib/Object.php +++ b/turba/lib/Object.php @@ -272,9 +272,11 @@ class Turba_Object { */ function deleteFile($file) { - $this->_vfsInit(); - - return $this->_vfs->deleteFile(TURBA_VFS_PATH . '/' . $this->getValue('__uid'), $file); + if (!is_a($result = $this->_vfsInit(), 'PEAR_Error')) { + return $this->_vfs->deleteFile(TURBA_VFS_PATH . '/' . $this->getValue('__uid'), $file); + } else { + return $result; + } } /** @@ -282,13 +284,15 @@ class Turba_Object { */ function deleteFiles() { - $this->_vfsInit(); + if (!is_a($result = $this->_vfsInit(), 'PEAR_Error')) { + if ($this->_vfs->exists(TURBA_VFS_PATH, $this->getValue('__uid'))) { + return $this->_vfs->deleteFolder(TURBA_VFS_PATH, $this->getValue('__uid'), true); + } - if ($this->_vfs->exists(TURBA_VFS_PATH, $this->getValue('__uid'))) { - return $this->_vfs->deleteFolder(TURBA_VFS_PATH, $this->getValue('__uid'), true); + return true; } - return true; + return $result; } /** -- 2.11.0