summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_installer.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-08-06 10:41:38 -0700
committerBharat Mediratta <bharat@menalto.com>2010-08-06 20:19:00 -0700
commit1b2da1ff70acba4177a7ebea825f802f24801a0c (patch)
treece7a9d08fd438d05109da1c1652702b622557894 /modules/gallery/helpers/gallery_installer.php
parent0fe44fe3809041edb64b69496bcee070578483d5 (diff)
Add a "weight" column to the module table. This allows us to specify
module ordering, which is currently being done in the moduleorder contrib module. By default, the weight will be the same as the id of the row which means that new modules will get added at the end of the list. This is covered in the upgrade case as well. The one gotcha is that we need to make sure that we don't try to sort by the weight column if the gallery module version is < 32, which is something we haven't done before. Fixes ticket #1272.
Diffstat (limited to 'modules/gallery/helpers/gallery_installer.php')
-rw-r--r--modules/gallery/helpers/gallery_installer.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index f5589618..8fc0cf96 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -144,8 +144,10 @@ class gallery_installer {
`active` BOOLEAN default 0,
`name` varchar(64) default NULL,
`version` int(9) default NULL,
+ `weight` int(9) default NULL,
PRIMARY KEY (`id`),
- UNIQUE KEY(`name`))
+ UNIQUE KEY(`name`),
+ KEY (`weight`))
DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {outgoing_translations} (
@@ -296,7 +298,7 @@ class gallery_installer {
module::set_var("gallery", "simultaneous_upload_limit", 5);
module::set_var("gallery", "admin_area_timeout", 90 * 60);
module::set_var("gallery", "maintenance_mode", 0);
- module::set_version("gallery", 31);
+ module::set_version("gallery", 32);
}
static function upgrade($version) {
@@ -561,6 +563,13 @@ class gallery_installer {
module::set_var("gallery", "maintenance_mode", 0);
module::set_version("gallery", $version = 31);
}
+
+ if ($version == 31) {
+ db::update("modules")
+ ->set("weight", "=", "id")
+ ->execute();
+ module::set_version("gallery", $version = 32);
+ }
}
static function uninstall() {