summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/controllers/admin_comments.php2
-rw-r--r--modules/comment/helpers/comment_installer.php7
-rw-r--r--modules/exif/helpers/exif_installer.php6
-rw-r--r--modules/notification/helpers/notification_installer.php4
-rw-r--r--modules/search/helpers/search_installer.php6
-rw-r--r--modules/search/helpers/search_task.php14
-rw-r--r--modules/tag/helpers/tag_event.php8
-rw-r--r--modules/tag/helpers/tag_installer.php8
-rw-r--r--modules/user/helpers/user_installer.php12
9 files changed, 34 insertions, 33 deletions
diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php
index cd408421..47e354af 100644
--- a/modules/comment/controllers/admin_comments.php
+++ b/modules/comment/controllers/admin_comments.php
@@ -57,7 +57,7 @@ class Admin_Comments_Controller extends Admin_Controller {
public function index() {
// Get rid of old deleted/spam comments
Database::instance()->query(
- "DELETE FROM `comments` " .
+ "DELETE FROM `[comments]` " .
"WHERE state IN ('deleted', 'spam') " .
"AND unix_timestamp(now()) - updated > 86400 * 7");
diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php
index 12caa547..a7852d05 100644
--- a/modules/comment/helpers/comment_installer.php
+++ b/modules/comment/helpers/comment_installer.php
@@ -23,7 +23,7 @@ class comment_installer {
$version = module::get_version("comment");
if ($version == 0) {
- $db->query("CREATE TABLE IF NOT EXISTS `comments` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[comments]` (
`author_id` int(9) default NULL,
`created` int(9) NOT NULL,
`guest_email` varchar(128) default NULL,
@@ -58,10 +58,11 @@ class comment_installer {
static function uninstall() {
$db = Database::instance();
- $sql = "SELECT `item_id` FROM `comments`";
+ $sql = "SELECT `item_id` FROM `[comments]`";
module::event("item_related_update_batch", $sql);
- $db->query("DROP TABLE IF EXISTS `comments`;");
+ $db->query("DROP TABLE IF EXISTS `[comments]
+`;");
module::delete("comment");
}
}
diff --git a/modules/exif/helpers/exif_installer.php b/modules/exif/helpers/exif_installer.php
index 791cd4a6..964a9e6c 100644
--- a/modules/exif/helpers/exif_installer.php
+++ b/modules/exif/helpers/exif_installer.php
@@ -23,7 +23,7 @@ class exif_installer {
if ($version == 0) {
$db = Database::instance();
- $db->query("CREATE TABLE IF NOT EXISTS `exif_keys` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[exif_keys]` (
`id` int(9) NOT NULL auto_increment,
`item_id` int(9) NOT NULL,
`name` varchar(64) NOT NULL,
@@ -32,7 +32,7 @@ class exif_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`item_id`, `summary`, `name`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- $db->query("CREATE TABLE IF NOT EXISTS `exif_records` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[exif_records]` (
`id` int(9) NOT NULL auto_increment,
`item_id` int(9) NOT NULL,
`dirty` BOOLEAN default 1,
@@ -44,7 +44,7 @@ class exif_installer {
static function uninstall() {
$db = Database::instance();
- $db->query("DROP TABLE IF EXISTS `exif_keys`;");
+ $db->query("DROP TABLE IF EXISTS `[exif_keys]`;");
module::delete("exif");
}
}
diff --git a/modules/notification/helpers/notification_installer.php b/modules/notification/helpers/notification_installer.php
index f705fe68..00fc82db 100644
--- a/modules/notification/helpers/notification_installer.php
+++ b/modules/notification/helpers/notification_installer.php
@@ -23,7 +23,7 @@ class notification_installer {
$version = module::get_version("notification");
if ($version == 0) {
- $db->query("CREATE TABLE IF NOT EXISTS `subscriptions` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[subscriptions]` (
`id` int(9) NOT NULL auto_increment,
`item_id` int(9) NOT NULL,
`user_id` int(9) NOT NULL,
@@ -38,7 +38,7 @@ class notification_installer {
static function uninstall() {
$db = Database::instance();
- $db->query("DROP TABLE IF EXISTS `subscriptions`;");
+ $db->query("DROP TABLE IF EXISTS `[subscriptions]`;");
module::delete("notification");
}
diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php
index b823f498..05775fec 100644
--- a/modules/search/helpers/search_installer.php
+++ b/modules/search/helpers/search_installer.php
@@ -22,7 +22,7 @@ class search_installer {
$version = module::get_version("search");
$db = Database::instance();
if ($version == 0) {
- $db->query("CREATE TABLE `search_records` (
+ $db->query("CREATE TABLE `[search_records]` (
`id` int(9) NOT NULL auto_increment,
`item_id` int(9),
`dirty` boolean default 1,
@@ -32,7 +32,7 @@ class search_installer {
ENGINE=MyISAM DEFAULT CHARSET=utf8;");
// populate the index with dirty records
- $db->query("insert into `search_records` (`item_id`) SELECT `id` FROM `items`");
+ $db->query("INSERT INTO `[search_records]` (`item_id`) SELECT `id` FROM `[items]`");
module::set_version("search", 1);
if (ORM::factory("search_record")->count_all() < 10) {
@@ -47,7 +47,7 @@ class search_installer {
static function uninstall() {
$db = Database::instance();
- $db->query("DROP TABLE `search_records`");
+ $db->query("DROP TABLE `[search_records]`");
site_status::clear("search_index_out_of_date");
module::delete("search");
}
diff --git a/modules/search/helpers/search_task.php b/modules/search/helpers/search_task.php
index ca5f8502..0071f2e0 100644
--- a/modules/search/helpers/search_task.php
+++ b/modules/search/helpers/search_task.php
@@ -21,16 +21,16 @@ class search_task_Core {
static function available_tasks() {
// Delete extra search_records
Database::instance()->query(
- "DELETE `search_records`.* FROM `search_records` " .
- "LEFT JOIN `items` ON (`search_records`.`item_id` = `items`.`id`) " .
- "WHERE `items`.`id` IS NULL");
+ "DELETE `[search_records]`.* FROM `[search_records]` " .
+ "LEFT JOIN `[items]` ON (`[search_records]`.`item_id` = `[items]`.`id`) " .
+ "WHERE `[items]`.`id` IS NULL");
// Insert missing search_records
Database::instance()->query(
- "INSERT INTO `search_records`(`item_id`) (" .
- " SELECT `items`.`id` FROM `items` " .
- " LEFT JOIN `search_records` ON (`search_records`.`item_id` = `items`.`id`) " .
- " WHERE `search_records`.`id` IS NULL)");
+ "INSERT INTO `[search_records]`(`item_id`) (" .
+ " SELECT `[items]`.`id` FROM `[items]` " .
+ " LEFT JOIN `[search_records]` ON (`[search_records]`.`item_id` = `[items]`.`id`) " .
+ " WHERE `[search_records]`.`id` IS NULL)");
list ($remaining, $total, $percent) = self::_get_stats();
return array(Task_Definition::factory()
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index 47391355..a0c7b159 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -50,10 +50,10 @@ class tag_event_Core {
static function item_before_delete($item) {
$db = Database::instance();
- $db->query("UPDATE `tags` SET `count` = `count` - 1 WHERE `count` > 0 " .
- "AND `id` IN (SELECT `tag_id` from `items_tags` WHERE `item_id` = $item->id)");
- $db->query("DELETE FROM `tags` WHERE `count` = 0 AND `id` IN (" .
- "SELECT `tag_id` from `items_tags` WHERE `item_id` = $item->id)");
+ $db->query("UPDATE `[tags]` SET `count` = `count` - 1 WHERE `count` > 0 " .
+ "AND `id` IN (SELECT `tag_id` from `[items_tags]` WHERE `item_id` = $item->id)");
+ $dbs->query("DELETE FROM `tags` WHERE `count` = 0 AND `id` IN (" .
+ "SELECT `tag_id` from `[items_tags]` WHERE `item_id` = $item->id)");
$db->delete("items_tags", array("item_id" => "$item->id"));
}
diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php
index 54ad52fe..1345cadb 100644
--- a/modules/tag/helpers/tag_installer.php
+++ b/modules/tag/helpers/tag_installer.php
@@ -22,7 +22,7 @@ class tag_installer {
$db = Database::instance();
$version = module::get_version("tag");
if ($version == 0) {
- $db->query("CREATE TABLE IF NOT EXISTS `tags` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[tags]` (
`id` int(9) NOT NULL auto_increment,
`name` varchar(64) NOT NULL,
`count` int(10) unsigned NOT NULL DEFAULT 0,
@@ -30,7 +30,7 @@ class tag_installer {
UNIQUE KEY(`name`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- $db->query("CREATE TABLE IF NOT EXISTS `items_tags` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[items_tags]` (
`id` int(9) NOT NULL auto_increment,
`item_id` int(9) NOT NULL,
`tag_id` int(9) NOT NULL,
@@ -44,8 +44,8 @@ class tag_installer {
static function uninstall() {
$db = Database::instance();
- $db->query("DROP TABLE IF EXISTS `tags`;");
- $db->query("DROP TABLE IF EXISTS `items_tags`;");
+ $db->query("DROP TABLE IF EXISTS `[tags]`;");
+ $db->query("DROP TABLE IF EXISTS `[items_tags]`;");
module::delete("tag");
}
}
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php
index f293e109..414327f5 100644
--- a/modules/user/helpers/user_installer.php
+++ b/modules/user/helpers/user_installer.php
@@ -23,7 +23,7 @@ class user_installer {
$version = module::get_version("user");
if ($version == 0) {
- $db->query("CREATE TABLE IF NOT EXISTS `users` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[users]` (
`id` int(9) NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`full_name` varchar(255) NOT NULL,
@@ -41,7 +41,7 @@ class user_installer {
UNIQUE KEY(`name`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- $db->query("CREATE TABLE IF NOT EXISTS `groups` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[groups]` (
`id` int(9) NOT NULL auto_increment,
`name` char(64) default NULL,
`special` BOOLEAN default 0,
@@ -49,7 +49,7 @@ class user_installer {
UNIQUE KEY(`name`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- $db->query("CREATE TABLE IF NOT EXISTS `groups_users` (
+ $db->query("CREATE TABLE IF NOT EXISTS `[groups_users]` (
`group_id` int(9) NOT NULL,
`user_id` int(9) NOT NULL,
PRIMARY KEY (`group_id`, `user_id`),
@@ -105,9 +105,9 @@ class user_installer {
} catch (Exception $e) {
}
$db = Database::instance();
- $db->query("DROP TABLE IF EXISTS `users`;");
- $db->query("DROP TABLE IF EXISTS `groups`;");
- $db->query("DROP TABLE IF EXISTS `groups_users`;");
+ $db->query("DROP TABLE IF EXISTS `[users]`;");
+ $db->query("DROP TABLE IF EXISTS `[groups]`;");
+ $db->query("DROP TABLE IF EXISTS `[groups_users]`;");
module::delete("user");
}
} \ No newline at end of file