From: Bartek Przybylski Date: Sun, 15 Jan 2012 10:51:01 +0000 (+0100) Subject: recursive gallery removing on parent dir remove X-Git-Tag: v3.0~40^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5ecc10b7567910e4cfee40aa2feea20090107f04;p=nextcloud-server.git recursive gallery removing on parent dir remove --- diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php index 6adff196071..72653c8de15 100644 --- a/apps/gallery/lib/album.php +++ b/apps/gallery/lib/album.php @@ -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){