Change gallery installer to do a direct update to the database, preppending gallery_graphics:: to each of the defined rules operations

This commit is contained in:
Tim Almdal 2009-09-27 17:55:48 -07:00
parent 467b74c310
commit c97a88599e
3 changed files with 4 additions and 32 deletions

View File

@ -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 File

@ -377,16 +377,8 @@ class gallery_installer {
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 File

@ -33,31 +33,11 @@ class watermark_installer {
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);
}
}
}