summaryrefslogtreecommitdiff
path: root/modules/watermark/helpers/watermark_installer.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-09-27 15:24:51 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-09-27 15:24:51 -0700
commit467b74c3106558d1656301b9c73236417d4421ac (patch)
tree6f5364ef698847b04b231852bb9791010006af24 /modules/watermark/helpers/watermark_installer.php
parent0ab73cd1adb2acac0f2b2f97acc8362083d9cdfa (diff)
This path requires the upgrader to be run and applies the following changes:
* moves the composite method back into core * requires that the operation be fully qualified i.e. gallery_graphics::resize * caches the graphics rules on each request
Diffstat (limited to 'modules/watermark/helpers/watermark_installer.php')
-rw-r--r--modules/watermark/helpers/watermark_installer.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/modules/watermark/helpers/watermark_installer.php b/modules/watermark/helpers/watermark_installer.php
index b3e91044..5c7dfdab 100644
--- a/modules/watermark/helpers/watermark_installer.php
+++ b/modules/watermark/helpers/watermark_installer.php
@@ -33,11 +33,31 @@ class watermark_installer {
DEFAULT CHARSET=utf8;");
@mkdir(VARPATH . "modules/watermark");
- module::set_version("watermark", 1);
+ module::set_version("watermark", 2);
}
static function uninstall() {
Database::instance()->query("DROP TABLE {watermarks}");
dir::unlink(VARPATH . "modules/watermark");
}
+
+ static function upgrade($version) {
+ $db = Database::instance();
+ if ($version == 1) {
+ graphics::remove_rules("watermark");
+ if ($name = module::get_var("watermark", "name")) {
+ foreach (array("thumb", "resize") as $target) {
+ graphics::add_rule(
+ "watermark", $target, "gallery_graphics::composite",
+ array("file" => VARPATH . "modules/watermark/$name",
+ "width" => module::get_var("watermark", "width"),
+ "height" => module::get_var("watermark", "height"),
+ "position" => module::get_var("watermark", "position"),
+ "transparency" => 101 - module::get_var("watermark", "transparency")),
+ 1000);
+ }
+ }
+ module::set_version("watermark", $version = 2);
+ }
+ }
}