Permalink
Browse files

Change gallery installer to do a direct update to the database, prepp…

…ending gallery_graphics:: to each of the defined rules operations
  • Loading branch information...
1 parent 467b74c commit c97a88599eb7b199294edbfae382353456061bef @talmdal talmdal committed Sep 28, 2009
View
2 installer/install.sql
@@ -228,7 +228,7 @@ CREATE TABLE {modules} (
UNIQUE KEY `name` (`name`)
) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
-INSERT INTO {modules} VALUES (1,1,'gallery',13);
+INSERT INTO {modules} VALUES (1,1,'gallery',14);
INSERT INTO {modules} VALUES (2,1,'user',1);
INSERT INTO {modules} VALUES (3,1,'comment',2);
INSERT INTO {modules} VALUES (4,1,'organize',1);
View
12 modules/gallery/helpers/gallery_installer.php
@@ -377,16 +377,8 @@ static function upgrade($version) {
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
- graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize");
- graphics::remove_rule("gallery", "resize", "gallery_graphics::resize");
- graphics::add_rule(
- "gallery", "thumb", "gallery_graphics::resize",
- array("width" => 200, "height" => 200, "master" => Image::AUTO),
- 100);
- graphics::add_rule(
- "gallery", "resize", "gallery_graphics::resize",
- array("width" => 640, "height" => 480, "master" => Image::AUTO),
- 100);
+ Database::instance()->query("update g3_graphics_rules g
+ set operation=concat(\"gallery_graphics::\", g.operation);");
module::set_version("gallery", $version = 14);
}
View
22 modules/watermark/helpers/watermark_installer.php
@@ -33,31 +33,11 @@ static function install() {
DEFAULT CHARSET=utf8;");
@mkdir(VARPATH . "modules/watermark");
- module::set_version("watermark", 2);
+ module::set_version("watermark", 1);
}
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);
- }
- }
}

0 comments on commit c97a885

Please sign in to comment.