summaryrefslogtreecommitdiff
path: root/core/helpers/graphics.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-26 05:43:06 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-26 05:43:06 +0000
commitdee20ed6a2bd92a2e67c27ccc7d60303d66cdcde (patch)
tree0d3b432effb5ba4cc8e6eb2c8627c9661d52ebe8 /core/helpers/graphics.php
parent0bef37eb0b077863984eb70ec99c40b2f32840bf (diff)
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.
Diffstat (limited to 'core/helpers/graphics.php')
-rw-r--r--core/helpers/graphics.php18
1 files changed, 17 insertions, 1 deletions
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, "<a href=\"#\">", "</a>"),
+ "graphics_dirty");
+ }
}
}