summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/gallery_task.php13
-rw-r--r--modules/gallery/helpers/graphics.php11
2 files changed, 20 insertions, 4 deletions
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";
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 605b9ff8..175ba947 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -102,11 +102,12 @@ class graphics_Core {
/**
* Rebuild the thumb and resize for the given item.
* @param Item_Model $item
+ * @return true on successful generation
*/
static function generate($item) {
if ($item->is_album()) {
if (!$cover = $item->album_cover()) {
- return;
+ return false;
}
$input_file = $cover->file_path();
$input_item = $cover;
@@ -123,7 +124,10 @@ class graphics_Core {
}
if (empty($ops)) {
- return;
+ $item->thumb_dirty = 0;
+ $item->resize_dirty = 0;
+ $item->save();
+ return true;
}
try {
@@ -167,7 +171,10 @@ class graphics_Core {
// @todo we should handle this better.
Kohana::log("error", "Caught exception rebuilding image: {$item->title}\n" .
$e->getTraceAsString());
+ return false;
}
+
+ return true;
}
/**