summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-09-16 22:23:32 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-09-16 22:23:32 -0700
commit9d76797b17d65540a903ef37eee6edca3e83108b (patch)
tree0040acb8746d68e21f06ab265493f4054e525908
parent5490057480f17e5810cf8b9e558769ebd74d4b27 (diff)
Changed the search module installer to explicitly specify MyISAM as the database type. Changed the packager to not remove the engine specification if the table is search_records. Fixes Ticket #774
-rwxr-xr-xinstaller/install.sql2
-rw-r--r--modules/gallery/controllers/packager.php10
-rw-r--r--modules/search/helpers/search_installer.php10
-rw-r--r--modules/search/module.info2
4 files changed, 20 insertions, 4 deletions
diff --git a/installer/install.sql b/installer/install.sql
index ca0ecadf..e8aaa681 100755
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -278,7 +278,7 @@ CREATE TABLE {search_records} (
PRIMARY KEY (`id`),
KEY `item_id` (`item_id`),
FULLTEXT KEY `data` (`data`)
-) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
INSERT INTO {search_records} VALUES (1,1,0,' Gallery');
DROP TABLE IF EXISTS {sessions};
diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php
index fbb1d07d..ae87d74b 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -114,18 +114,24 @@ class Packager_Controller extends Controller {
$root = ORM::factory("item", 1);
$root_created_timestamp = $root->created;
$root_updated_timestamp = $root->updated;
+ $table_name = "";
foreach (file($sql_file) as $line) {
// Prefix tables
$line = preg_replace(
"/(CREATE TABLE|IF EXISTS|INSERT INTO) `{$dbconfig['table_prefix']}(\w+)`/", "\\1 {\\2}",
$line);
+ if (preg_match("/CREATE TABLE {(\w+)}/", $line, $matches)) {
+ $table_name = $matches[1];
+ }
// Normalize dates
$line = preg_replace("/,$root_created_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
$line = preg_replace("/,$root_updated_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
- // Remove ENGINE= specifications
- $line = preg_replace("/ENGINE=\S+ /", "", $line);
+ // Remove ENGINE= specifications execpt for search records, it always needs to be MyISAM
+ if ($table_name != "search_records") {
+ $line = preg_replace("/ENGINE=\S+ /", "", $line);
+ }
$buf .= $line;
}
diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php
index 10d8211f..096f46c7 100644
--- a/modules/search/helpers/search_installer.php
+++ b/modules/search/helpers/search_installer.php
@@ -28,6 +28,7 @@ class search_installer {
PRIMARY KEY (`id`),
KEY(`item_id`),
FULLTEXT INDEX (`data`))
+ ENGINE=MYISAM
DEFAULT CHARSET=utf8;");
module::set_version("search", 1);
}
@@ -47,4 +48,13 @@ class search_installer {
static function uninstall() {
Database::instance()->query("DROP TABLE {search_records}");
}
+
+ static function upgrade($version) {
+ $db = Database::instance();
+ if ($version == 1) {
+ $db->query("ALTER TABLE {search_records} ENGINE=MYISAM");
+ module::set_version("search", 2);
+ }
+ }
+
}
diff --git a/modules/search/module.info b/modules/search/module.info
index f417c4fa..2f2ebdf1 100644
--- a/modules/search/module.info
+++ b/modules/search/module.info
@@ -1,3 +1,3 @@
name = "Search"
description = "Allows users to search their Gallery"
-version = 1
+version = 2