]> source.dussan.org Git - nextcloud-server.git/commitdiff
recursive gallery removing on parent dir remove
authorBartek Przybylski <bart.p.pl@gmail.com>
Sun, 15 Jan 2012 10:51:01 +0000 (11:51 +0100)
committerBartek Przybylski <bart.p.pl@gmail.com>
Sun, 15 Jan 2012 11:15:22 +0000 (12:15 +0100)
apps/gallery/lib/album.php

index 6adff196071742a83f981bfc73e3b041ad3bd8c1..72653c8de15c0609d206498a18d9228bbd031599 100644 (file)
@@ -48,6 +48,14 @@ class OC_Gallery_Album {
     $album = $album->fetchRow();
     self::remove($owner, $album['album_name']);
     OC_Gallery_Photo::removeByAlbumId($album['album_id']);
+    // find and remove any gallery which might be stored lower in dir hierarchy
+    $path = $path.'/%';
+    $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE album_path LIKE ? AND uid_owner = ?');
+    $result = $stmt->execute(array($path, $owner));
+    while (($album = $result->fetchRow())) {
+      OC_Gallery_Photo::removeByAlbumId($album['album_id']);
+      self::remove($owner, $album['album_name']);
+    }
   }
        
   public static function find($owner, $name=null, $path=null){