From dee20ed6a2bd92a2e67c27ccc7d60303d66cdcde Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 26 Dec 2008 05:43:06 +0000 Subject: Added the concept of "permanent" messages that we show to admins. Use this to show a "your thumbs/resizes are out of date" message whenever we change the graphics rules. Tweak watermark module to add graphics rules whenever we make a change, which triggers the graphics module to add the permanent message. --- core/helpers/graphics.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'core/helpers/graphics.php') diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php index c695abb2..b0d5a08e 100644 --- a/core/helpers/graphics.php +++ b/core/helpers/graphics.php @@ -44,6 +44,8 @@ class graphics_Core { $rule->priority = $priority; $rule->args = serialize($args); $rule->save(); + + self::mark_all_dirty(); } /** @@ -52,7 +54,10 @@ class graphics_Core { */ public static function remove_rules($module_name) { $db = Database::instance(); - $db->query("DELETE FROM `graphics_rules` WHERE `module_name` = '$module_name'"); + $result = $db->query("DELETE FROM `graphics_rules` WHERE `module_name` = '$module_name'"); + if ($result->count()) { + self::mark_all_dirty(); + } } /** @@ -129,5 +134,16 @@ class graphics_Core { */ public static function mark_all_dirty() { Database::instance()->query("UPDATE `items` SET `thumb_dirty` = 1, `resize_dirty` = 1"); + + $count = ORM::factory("item") + ->where("thumb_dirty", 1) + ->orwhere("resize_dirty", 1) + ->count_all(); + if ($count) { + message::warning( + sprintf(_("%d of your photos are out of date. %sClick here to fix them%s"), + $count, "", ""), + "graphics_dirty"); + } } } -- cgit v1.2.3