diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-01-25 21:07:43 +0100 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-01-25 21:07:43 +0100 |
commit | 5172e0a7a388fc2c22c9e10435f0ee2728dc5e36 (patch) | |
tree | eecdf205702bb4ef61a8582a77791c86e1221db9 | |
parent | e6298325f6c67c2913167df5dbdcd8938290f135 (diff) | |
download | nextcloud-server-5172e0a7a388fc2c22c9e10435f0ee2728dc5e36.tar.gz nextcloud-server-5172e0a7a388fc2c22c9e10435f0ee2728dc5e36.zip |
creating thumbnails on upload, recursive remove
-rw-r--r-- | apps/gallery/lib/hooks_handlers.php | 16 | ||||
-rw-r--r-- | apps/gallery/lib/images_utils.php | 6 | ||||
-rw-r--r-- | apps/gallery/lib/photo.php | 2 |
3 files changed, 8 insertions, 16 deletions
diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index 53a924ff40a..236a4b96a07 100644 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -63,21 +63,8 @@ class OC_Gallery_Hooks_Handlers { if (!self::isPhoto($fullpath)) return; - OC_Log::write(self::$APP_TAG, 'Adding file with path '. $fullpath, OC_Log::DEBUG); $path = substr($fullpath, 0, strrpos($fullpath, '/')); - if ($path == '') $path = '/'; - $album = OC_Gallery_Album::find(OC_User::getUser(), null, $path); - - if ($album->numRows() == 0) { - $album = self::createAlbum($path); - } - $album = $album->fetchRow(); - $albumId = $album['album_id']; - $photo = OC_Gallery_Photo::find($albumId, $fullpath); - if ($photo->numRows() == 0) { // don't duplicate photo entries - OC_Log::write(self::$APP_TAG, 'Adding new photo to album', OC_Log::DEBUG); - OC_Gallery_Photo::create($albumId, $fullpath); - } + OC_Gallery_Scanner::scanDir($path, $albums); } @@ -85,6 +72,7 @@ class OC_Gallery_Hooks_Handlers { $path = $params[OC_Filesystem::signal_param_path]; if (OC_Filesystem::is_dir($path) && self::directoryContainsPhotos($path)) { OC_Gallery_Album::removeByPath($path, OC_User::getUser()); + OC_Gallery_Photo::removeByPath($path.'/%'); } elseif (self::isPhoto($path)) { OC_Gallery_Photo::removeByPath($path); } diff --git a/apps/gallery/lib/images_utils.php b/apps/gallery/lib/images_utils.php index 0cfa52eb564..126298913be 100644 --- a/apps/gallery/lib/images_utils.php +++ b/apps/gallery/lib/images_utils.php @@ -21,7 +21,11 @@ * */ -require_once('../../../lib/base.php'); +if (file_exists('../../../lib/base.php')) + require_once('../../../lib/base.php'); +elseif (file_exists('lib/base.php')) + require_once('lib/base.php'); + OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php index 14b0c4b2a07..d1fb166aee9 100644 --- a/apps/gallery/lib/photo.php +++ b/apps/gallery/lib/photo.php @@ -47,7 +47,7 @@ class OC_Gallery_Photo{ } public static function removeByPath($path) { - $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path = ?'); + $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path LIKE ?'); $stmt->execute(array($path)); } |