summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_installer.php
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2010-02-22 00:30:54 -0800
committerAndy Staudacher <andy.st@gmail.com>2010-02-22 00:30:54 -0800
commit6ce01328422cc587dedf555d0ba3eb8a0ee05a9f (patch)
tree01f7d738e89b732b99c3cc735f0f822c84a2aeb6 /modules/gallery/helpers/gallery_installer.php
parent95374070db74362bc1481e3fdcdab0d89678c1bc (diff)
Fix for ticket #1027: Add index on cache key column.
(and fix the packager to truncate the cache table before packaging)
Diffstat (limited to 'modules/gallery/helpers/gallery_installer.php')
-rw-r--r--modules/gallery/helpers/gallery_installer.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index b594ddcf..6f8a6688 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -32,6 +32,10 @@ class gallery_installer {
PRIMARY KEY (`id`))
DEFAULT CHARSET=utf8;");
+ // Using a simple index instead of a unique key for the
+ // key column to avoid handling of concurrency issues
+ // on insert. Thus allowing concurrent inserts on the
+ // same cache key, as does Memcache / xcache.
$db->query("CREATE TABLE {caches} (
`id` int(9) NOT NULL auto_increment,
`key` varchar(255) NOT NULL,
@@ -39,6 +43,7 @@ class gallery_installer {
`expiration` int(9) NOT NULL,
`cache` longblob,
PRIMARY KEY (`id`),
+ KEY (`key`),
KEY (`tags`))
DEFAULT CHARSET=utf8;");
@@ -290,7 +295,7 @@ class gallery_installer {
module::set_var("gallery", "credits", (string) $powered_by_string);
module::set_var("gallery", "simultaneous_upload_limit", 5);
module::set_var("gallery", "admin_area_timeout", 90 * 60);
- module::set_version("gallery", 29);
+ module::set_version("gallery", 30);
}
static function upgrade($version) {
@@ -545,6 +550,11 @@ class gallery_installer {
module::set_var("gallery", "credits", "Powered by <a href=\"%url\">%gallery_version</a>");
module::set_version("gallery", $version = 29);
}
+
+ if ($version == 29) {
+ $db->query("ALTER TABLE {caches} ADD KEY (`key`);");
+ module::set_version("gallery", $version = 30);
+ }
}
static function uninstall() {