From c7f49fd1ec3ed7d2261b46e35d21d59a3af11f49 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 4 Jun 2009 23:20:54 -0700 Subject: Skip over busted images when rebuilding. Change graphics::generate() to return true/false on whether or not it could rebuild the image properly, then track the broke images in the task and ignore them. Fixes ticket #344. --- modules/gallery/helpers/gallery_task.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'modules/gallery/helpers/gallery_task.php') diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php index 6046bfc4..2493c49e 100644 --- a/modules/gallery/helpers/gallery_task.php +++ b/modules/gallery/helpers/gallery_task.php @@ -46,14 +46,22 @@ class gallery_task_Core { */ static function rebuild_dirty_images($task) { $result = graphics::find_dirty_images_query(); - $remaining = $result->count(); $completed = $task->get("completed", 0); + $ignored = $task->get("ignored", array()); + $remaining = $result->count() - count($ignored); $i = 0; foreach ($result as $row) { + if (array_key_exists($row->id, $ignored)) { + continue; + } + $item = ORM::factory("item", $row->id); if ($item->loaded) { - graphics::generate($item); + $success = graphics::generate($item); + if (!$success) { + $ignored[$item->id] = 1; + } } $completed++; @@ -76,6 +84,7 @@ class gallery_task_Core { } $task->set("completed", $completed); + $task->set("ignored", $ignored); if ($remaining == 0) { $task->done = true; $task->state = "success"; -- cgit v1.2.3