[dev] Patch to delete all images in gallery when gallery is deleted.

Tyler Colbert tyler-hordeml at colberts.us
Wed Sep 3 16:37:35 PDT 2003


The subject pretty much says it all.  The attached patch is to ansel/gallery.php
and causes ansel to delete all images in a gallery when the gallery is deleted.

I guess I should add a confirmation dialog as well...

--
Tyler Colbert
-------------- next part --------------
Index: gallery.php
===================================================================
RCS file: /repository/ansel/gallery.php,v
retrieving revision 1.11
diff -u -r1.11 gallery.php
--- gallery.php	27 Aug 2003 16:41:55 -0000	1.11
+++ gallery.php	3 Sep 2003 23:29:09 -0000
@@ -109,6 +109,11 @@
         if (is_a($gallery, 'PEAR_Error') || !$gallery->hasPermission(Auth::getAuth(), _PERMS_DELETE)) {
             $notification->push(sprintf(_("Access denied deleting gallery %s."), $gallery['name']), 'horde.error');
         } else {
+            if (count($imageList = $gallery->listImages())) {
+                foreach ($imageList as $id => $image) {
+                    $gallery->removeImage($id);
+                }
+            }
             $result = $ansel_shares->removeShare($gallery);
             if (!is_a($result, 'PEAR_Error')) {
                 $notification->push(_("Deleted the gallery."), 'horde.success');


More information about the dev mailing list