From d3a161ca1bb388593e03bd5c57c60ea249b3fe8d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 6 Aug 2010 10:41:38 -0700 Subject: 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. --- installer/install.sql | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'installer/install.sql') diff --git a/installer/install.sql b/installer/install.sql index 8836f53f..18cf607a 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -236,20 +236,22 @@ CREATE TABLE {modules} ( `active` tinyint(1) DEFAULT '0', `name` varchar(64) DEFAULT NULL, `version` int(9) DEFAULT NULL, + `weight` int(9) DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) + UNIQUE KEY `name` (`name`), + KEY `weight` (`weight`) ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {modules} VALUES (1,1,'gallery',31); -INSERT INTO {modules} VALUES (2,1,'user',3); -INSERT INTO {modules} VALUES (3,1,'comment',3); -INSERT INTO {modules} VALUES (4,1,'organize',1); -INSERT INTO {modules} VALUES (5,1,'info',1); -INSERT INTO {modules} VALUES (6,1,'rest',3); -INSERT INTO {modules} VALUES (7,1,'rss',1); -INSERT INTO {modules} VALUES (8,1,'search',1); -INSERT INTO {modules} VALUES (9,1,'slideshow',2); -INSERT INTO {modules} VALUES (10,1,'tag',2); +INSERT INTO {modules} VALUES (1,1,'gallery',32,1); +INSERT INTO {modules} VALUES (2,1,'user',3,2); +INSERT INTO {modules} VALUES (3,1,'comment',3,3); +INSERT INTO {modules} VALUES (4,1,'organize',1,4); +INSERT INTO {modules} VALUES (5,1,'info',1,5); +INSERT INTO {modules} VALUES (6,1,'rest',3,6); +INSERT INTO {modules} VALUES (7,1,'rss',1,7); +INSERT INTO {modules} VALUES (8,1,'search',1,8); +INSERT INTO {modules} VALUES (9,1,'slideshow',2,9); +INSERT INTO {modules} VALUES (10,1,'tag',2,10); DROP TABLE IF EXISTS {outgoing_translations}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -391,7 +393,7 @@ CREATE TABLE {vars} ( `value` text, PRIMARY KEY (`id`), UNIQUE KEY `module_name` (`module_name`,`name`) -) AUTO_INCREMENT=42 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=43 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind'); INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind'); @@ -408,14 +410,14 @@ INSERT INTO {vars} VALUES (NULL,'gallery','simultaneous_upload_limit','5'); INSERT INTO {vars} VALUES (NULL,'gallery','admin_area_timeout','5400'); INSERT INTO {vars} VALUES (NULL,'gallery','maintenance_mode','0'); INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}'); -INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody'); INSERT INTO {vars} VALUES (NULL,'gallery','date_time_format','Y-M-d H:i:s'); INSERT INTO {vars} VALUES (NULL,'gallery','date_format','Y-M-d'); INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:3:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}'); INSERT INTO {vars} VALUES (NULL,'gallery','choose_default_tookit','1'); +INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody'); +INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:4:{i:9;a:2:{i:0;s:7:\"gallery\";i:1;s:8:\"language\";}i:10;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:11;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:12;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user'); INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0'); INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5'); INSERT INTO {vars} VALUES (NULL,'rest','allow_guest_access','0'); -INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:3:{i:9;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:10;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:11;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); INSERT INTO {vars} VALUES (NULL,'slideshow','max_scale','0'); -- cgit v1.2.3 From b6a377bc8219a5354778692086cd11b8fd05f927 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 14 Aug 2010 15:08:38 -0700 Subject: Update install.sql for gallery module version 3. This was left out of 779d91cca01567a09b894e9fff4dfa32cb82d3d9 but it doesn't cause any real damage, it just means that anybody who got the code in the intervening window and did an initial install required an upgrade as well. --- installer/install.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'installer/install.sql') diff --git a/installer/install.sql b/installer/install.sql index 18cf607a..0df82086 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -184,7 +184,8 @@ CREATE TABLE {items} ( KEY `parent_id` (`parent_id`), KEY `type` (`type`), KEY `random` (`rand_key`), - KEY `weight` (`weight`) + KEY `weight` (`weight`), + KEY `left_ptr` (`left_ptr`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1'); @@ -242,7 +243,7 @@ CREATE TABLE {modules} ( KEY `weight` (`weight`) ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {modules} VALUES (1,1,'gallery',32,1); +INSERT INTO {modules} VALUES (1,1,'gallery',33,1); INSERT INTO {modules} VALUES (2,1,'user',3,2); INSERT INTO {modules} VALUES (3,1,'comment',3,3); INSERT INTO {modules} VALUES (4,1,'organize',1,4); -- cgit v1.2.3 From 50e3230d79b8736f78ebaa4f1c7e6df1c29b3243 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 14 Aug 2010 15:10:07 -0700 Subject: Add a key on access_caches.item_id. Without this, the Fix task query to find missing access_caches is very slow. Bump Gallery module to v34. --- installer/install.sql | 5 +++-- modules/gallery/helpers/gallery_installer.php | 10 ++++++++-- modules/gallery/module.info | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'installer/install.sql') diff --git a/installer/install.sql b/installer/install.sql index 0df82086..c6314aa7 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -10,7 +10,8 @@ CREATE TABLE {access_caches} ( `view_full_2` binary(1) NOT NULL DEFAULT '0', `edit_2` binary(1) NOT NULL DEFAULT '0', `add_2` binary(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + KEY `item_id` (`item_id`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {access_caches} VALUES (1,1,'1','0','0','1','0','0'); @@ -243,7 +244,7 @@ CREATE TABLE {modules} ( KEY `weight` (`weight`) ) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {modules} VALUES (1,1,'gallery',33,1); +INSERT INTO {modules} VALUES (1,1,'gallery',34,1); INSERT INTO {modules} VALUES (2,1,'user',3,2); INSERT INTO {modules} VALUES (3,1,'comment',3,3); INSERT INTO {modules} VALUES (4,1,'organize',1,4); diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 21c47ad5..569c5118 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -23,7 +23,8 @@ class gallery_installer { $db->query("CREATE TABLE {access_caches} ( `id` int(9) NOT NULL auto_increment, `item_id` int(9), - PRIMARY KEY (`id`)) + PRIMARY KEY (`id`), + KEY (`item_id`)) DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE {access_intents} ( @@ -299,7 +300,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", 33); + module::set_version("gallery", 34); } static function upgrade($version) { @@ -578,6 +579,11 @@ class gallery_installer { $db->query("ALTER TABLE {items} ADD KEY (`left_ptr`)"); module::set_version("gallery", $version = 33); } + + if ($version == 33) { + $db->query("ALTER TABLE {access_caches} ADD KEY (`item_id`)"); + module::set_version("gallery", $version = 34); + } } static function uninstall() { diff --git a/modules/gallery/module.info b/modules/gallery/module.info index dbecda03..084a0945 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 33 +version = 34 -- cgit v1.2.3