Skip to content

Commit

Permalink
Add a key on access_caches.item_id. Without this, the Fix task query
Browse files Browse the repository at this point in the history
to find missing access_caches is very slow.  Bump Gallery module to v34.
  • Loading branch information
bharat committed Aug 14, 2010
1 parent b6a377b commit 50e3230
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions installer/install.sql
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 8 additions & 2 deletions modules/gallery/helpers/gallery_installer.php
Expand Up @@ -23,7 +23,8 @@ static function install() {
$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} (
Expand Down Expand Up @@ -299,7 +300,7 @@ static function install() {
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) {
Expand Down Expand Up @@ -578,6 +579,11 @@ static function upgrade($version) {
$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() {
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
version = 33
version = 34

0 comments on commit 50e3230

Please sign in to comment.