Ignore exceptions from VFS when deleting the image cache
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 30 Mar 2010 16:55:36 +0000 (12:55 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 30 Mar 2010 16:56:15 +0000 (12:56 -0400)
ansel/lib/Faces.php
ansel/lib/GalleryMode/Date.php
ansel/lib/GalleryMode/Normal.php

index 0ddec85..786805e 100644 (file)
@@ -52,16 +52,18 @@ class Ansel_Faces
             if ($face instanceof PEAR_Error) {
                 throw new Horde_Exception_Prior($face);
             }
-
-            foreach ($face as $id) {
-                $GLOBALS['ansel_vfs']->deleteFile($path, $id . $ext);
-            }
-
+            try {
+                foreach ($face as $id) {
+                    $GLOBALS['ansel_vfs']->deleteFile($path, $id . $ext);
+                }
+            } catch (VFS_Exception $e) {}
             $GLOBALS['ansel_db']->exec('DELETE FROM ansel_faces WHERE image_id = ' . $image->id);
             $GLOBALS['ansel_db']->exec('UPDATE ansel_images SET image_faces = 0 WHERE image_id = ' . $image->id . ' AND image_faces > 0 ');
             $GLOBALS['ansel_db']->exec('UPDATE ansel_shares SET attribute_faces = attribute_faces - ' . count($face) . ' WHERE gallery_id = ' . $image->gallery . ' AND attribute_faces > 0 ');
         } else {
-            $GLOBALS['ansel_vfs']->deleteFile($path, (int)$face . $ext);
+            try {
+                $GLOBALS['ansel_vfs']->deleteFile($path, (int)$face . $ext);
+            } catch (VFS_Exception $e) {}
             $GLOBALS['ansel_db']->exec('DELETE FROM ansel_faces WHERE face_id = ' . (int)$face);
             $GLOBALS['ansel_db']->exec('UPDATE ansel_images SET image_faces = image_faces - 1 WHERE image_id = ' . $image->id . ' AND image_faces > 0 ');
             $GLOBALS['ansel_db']->exec('UPDATE ansel_shares SET attribute_faces = attribute_faces - 1 WHERE gallery_id = ' . $image->gallery . ' AND attribute_faces > 0 ');
index 2ec55ab..ac86800 100644 (file)
@@ -520,8 +520,10 @@ class Ansel_GalleryMode_Date {
         $image->deleteCache();
 
         /* Delete original image from VFS. */
-        $GLOBALS['ansel_vfs']->deleteFile($image->getVFSPath('full'),
-                                          $image->getVFSName('full'));
+        try {
+            $GLOBALS['ansel_vfs']->deleteFile($image->getVFSPath('full'),
+                                              $image->getVFSName('full'));
+        } catch (VFS_Exception $e) {}
 
         /* Delete from SQL. */
         $this->_gallery->_shareOb->_write_db->exec('DELETE FROM ansel_images WHERE image_id = ' . (int)$image->id);
index 4fb9cf0..0915dd6 100644 (file)
@@ -226,8 +226,10 @@ class Ansel_GalleryMode_Normal {
         $image->deleteCache();
 
         /* Delete original image from VFS. */
-        $GLOBALS['ansel_vfs']->deleteFile($image->getVFSPath('full'),
-                                          $image->getVFSName('full'));
+        try {
+            $GLOBALS['ansel_vfs']->deleteFile($image->getVFSPath('full'),
+                                              $image->getVFSName('full'));
+        } catch (VFS_Exception $e) {}
 
         /* Delete from SQL. */
         $this->_gallery->_shareOb->_write_db->exec('DELETE FROM ansel_images WHERE image_id = ' . (int)$image->id);