From d8049cf711ffe9b6b7f531ea77dac23b86066516 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 15 Feb 2009 00:57:19 +0000 Subject: Album cover fixes. Don't bomb in generate if we can't load the album cover (it might be deleted and we forgot to update the album_cover_item_id column). Also, exclude albums with missing album_cover_item_id's from the dirty query. --- core/helpers/graphics.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/helpers') diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php index 4292bcbb..4ec21ee8 100644 --- a/core/helpers/graphics.php +++ b/core/helpers/graphics.php @@ -83,7 +83,11 @@ class graphics_Core { */ static function generate($item) { if ($item->is_album()) { - $cover = $item->album_cover(); + try { + $cover = $item->album_cover(); + } catch (Exception $e) { + return; + } if (!$cover) { return; } @@ -217,7 +221,7 @@ class graphics_Core { static function find_dirty_images_query() { return Database::instance()->query( "SELECT `id` FROM `items` " . - "WHERE (`thumb_dirty` = 1 AND (`type` <> 'album' OR `right` - `left` > 1))" . + "WHERE (`thumb_dirty` = 1 AND (`type` <> 'album' OR `album_cover_item_id` IS NOT NULL))" . " OR (`resize_dirty` = 1 AND `type` = 'photo')"); } -- cgit v1.2.3