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 +++++++++++-- modules/gallery/helpers/graphics.php | 11 +++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'modules/gallery/helpers') 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; } /** -- cgit v1.2.3 From 7612c8d4045bb8347c8f0548269d8cc7a028bc4a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 5 Jun 2009 15:48:04 +0800 Subject: Localize the 'Advanced' menu item Signed-off-by: Bharat Mediratta --- modules/gallery/helpers/gallery_menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_menu.php b/modules/gallery/helpers/gallery_menu.php index 2a9e193b..854086c1 100644 --- a/modules/gallery/helpers/gallery_menu.php +++ b/modules/gallery/helpers/gallery_menu.php @@ -133,7 +133,7 @@ class gallery_menu_Core { access::csrf_token()))) ->append(Menu::factory("link") ->id("advanced") - ->label("Advanced") + ->label(t("Advanced")) ->url(url::site("admin/advanced_settings")))) ->append(Menu::factory("link") ->id("modules") -- cgit v1.2.3 From 62a63676d45d4d87aa126ec8fb8694868be0c27a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 5 Jun 2009 15:58:25 +0800 Subject: Add Belarusian to the language list. Signed-off-by: Bharat Mediratta --- modules/gallery/helpers/locale.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/locale.php b/modules/gallery/helpers/locale.php index 2ba0f255..1ba2f003 100644 --- a/modules/gallery/helpers/locale.php +++ b/modules/gallery/helpers/locale.php @@ -59,6 +59,7 @@ class locale_Core { private static function _init_language_data() { $l["af_ZA"] = "Afrikaans"; // Afrikaans $l["ar_SA"] = "العربية"; // Arabic + $l["be_RU"] = "Belarusian"; // Belarusian $l["bg_BG"] = "Български"; // Bulgarian $l["ca_ES"] = "Catalan"; // Catalan $l["cs_CZ"] = "Česky"; // Czech -- cgit v1.2.3 From 710d13aeceefc4bc5018acd4602c0975f4c6c048 Mon Sep 17 00:00:00 2001 From: unostar Date: Fri, 5 Jun 2009 21:32:06 +0800 Subject: Correct locale and local translation Signed-off-by: Bharat Mediratta --- modules/gallery/helpers/locale.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/locale.php b/modules/gallery/helpers/locale.php index 1ba2f003..c176dcc6 100644 --- a/modules/gallery/helpers/locale.php +++ b/modules/gallery/helpers/locale.php @@ -59,7 +59,7 @@ class locale_Core { private static function _init_language_data() { $l["af_ZA"] = "Afrikaans"; // Afrikaans $l["ar_SA"] = "العربية"; // Arabic - $l["be_RU"] = "Belarusian"; // Belarusian + $l["be_BY"] = "Беларускі"; // Belarusian $l["bg_BG"] = "Български"; // Bulgarian $l["ca_ES"] = "Catalan"; // Catalan $l["cs_CZ"] = "Česky"; // Czech -- cgit v1.2.3 From 275c25eb5670e25fad25830cf0c30cd804dce41f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 6 Jun 2009 08:37:49 +0800 Subject: Add the exception message to the trace string when there's a graphics failure. Signed-off-by: Bharat Mediratta --- modules/gallery/helpers/graphics.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 175ba947..4846fa8a 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -170,6 +170,7 @@ class graphics_Core { // Something went wrong rebuilding the image. Leave it dirty and move on. // @todo we should handle this better. Kohana::log("error", "Caught exception rebuilding image: {$item->title}\n" . + $e->getMessage() . "\n" . $e->getTraceAsString()); return false; } -- cgit v1.2.3 From 3275401f690ce8fe461d2986efce58a21d1f6308 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 5 Jun 2009 17:44:36 -0700 Subject: change the version to beta 1 --- modules/gallery/helpers/gallery_installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index b97adcd0..242bb486 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -249,7 +249,7 @@ class gallery_installer { block_manager::add("dashboard_center", "gallery", "log_entries"); module::set_version("gallery", 1); - module::set_var("gallery", "version", "3.0 pre-beta git"); + module::set_var("gallery", "version", "3.0 beta 1"); module::set_var("gallery", "choose_default_tookit", 1); // @todo this string needs to be picked up by l10n_scanner -- cgit v1.2.3