summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBartek Przybylski <bart.p.pl@gmail.com>2012-01-15 11:51:01 +0100
committerBartek Przybylski <bart.p.pl@gmail.com>2012-01-15 12:15:22 +0100
commit5ecc10b7567910e4cfee40aa2feea20090107f04 (patch)
treea203d18626e3d1e963ec27191a1f4017a7162e50 /apps
parent9c048586318f7d34544b5996e80afea8249a54bf (diff)
downloadnextcloud-server-5ecc10b7567910e4cfee40aa2feea20090107f04.tar.gz
nextcloud-server-5ecc10b7567910e4cfee40aa2feea20090107f04.zip
recursive gallery removing on parent dir remove
Diffstat (limited to 'apps')
-rw-r--r--apps/gallery/lib/album.php8
1 files changed, 8 insertions, 0 deletions
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){