summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-20 01:24:21 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-20 01:24:21 -0700
commitacd54fefdabf9eabd16f04bb76cf128c479b0291 (patch)
treedc677c7af312b0d22ec27179a2a3c681b0c7d551 /modules
parentb72d0db7bee59d04dfc5036b35586210e81718e6 (diff)
Fix a bug in gallery_installer where on an initial install we were
only implementing schema version 1. This caused install.sql to be populated from version 1 which meant that after install you'd have to run the upgrader. No harm done, and the pattern is fixed for the future. Alphabetize the tables so it's easier to find stuff.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/gallery_installer.php65
1 files changed, 33 insertions, 32 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index b2be63be..cd871c17 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -50,6 +50,18 @@ class gallery_installer {
PRIMARY KEY (`id`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ $db->query("CREATE TABLE {incoming_translations} (
+ `id` int(9) NOT NULL auto_increment,
+ `key` char(32) NOT NULL,
+ `locale` char(10) NOT NULL,
+ `message` text NOT NULL,
+ `revision` int(9) DEFAULT NULL,
+ `translation` text,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY(`key`, `locale`),
+ KEY `locale_key` (`locale`, `key`))
+ ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+
$db->query("CREATE TABLE {items} (
`id` int(9) NOT NULL auto_increment,
`album_cover_item_id` int(9) default NULL,
@@ -117,44 +129,24 @@ class gallery_installer {
UNIQUE KEY(`name`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- $db->query("CREATE TABLE {themes} (
- `id` int(9) NOT NULL auto_increment,
- `name` varchar(64) default NULL,
- `version` int(9) default NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
-
- $db->query("CREATE TABLE {permissions} (
- `id` int(9) NOT NULL auto_increment,
- `display_name` varchar(64) default NULL,
- `name` varchar(64) default NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
-
- $db->query("CREATE TABLE {incoming_translations} (
+ $db->query("CREATE TABLE {outgoing_translations} (
`id` int(9) NOT NULL auto_increment,
+ `base_revision` int(9) DEFAULT NULL,
`key` char(32) NOT NULL,
`locale` char(10) NOT NULL,
`message` text NOT NULL,
- `revision` int(9) DEFAULT NULL,
`translation` text,
PRIMARY KEY (`id`),
UNIQUE KEY(`key`, `locale`),
KEY `locale_key` (`locale`, `key`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- $db->query("CREATE TABLE {outgoing_translations} (
+ $db->query("CREATE TABLE {permissions} (
`id` int(9) NOT NULL auto_increment,
- `base_revision` int(9) DEFAULT NULL,
- `key` char(32) NOT NULL,
- `locale` char(10) NOT NULL,
- `message` text NOT NULL,
- `translation` text,
+ `display_name` varchar(64) default NULL,
+ `name` varchar(64) default NULL,
PRIMARY KEY (`id`),
- UNIQUE KEY(`key`, `locale`),
- KEY `locale_key` (`locale`, `key`))
+ UNIQUE KEY(`name`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {sessions} (
@@ -179,6 +171,14 @@ class gallery_installer {
KEY (`owner_id`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ $db->query("CREATE TABLE {themes} (
+ `id` int(9) NOT NULL auto_increment,
+ `name` varchar(64) default NULL,
+ `version` int(9) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY(`name`))
+ ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+
$db->query("CREATE TABLE {vars} (
`id` int(9) NOT NULL auto_increment,
`module_name` varchar(64) NOT NULL,
@@ -248,18 +248,20 @@ class gallery_installer {
block_manager::add("dashboard_center", "gallery", "photo_stream");
block_manager::add("dashboard_center", "gallery", "log_entries");
- module::set_version("gallery", 1);
+ module::set_version("gallery", $version = 1);
module::set_var("gallery", "version", "3.0 beta 1");
module::set_var("gallery", "choose_default_tookit", 1);
// @todo this string needs to be picked up by l10n_scanner
module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>");
- } else if ($version == 1) {
+ }
+
+ if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_var("gallery", "version", "3.0 pre beta 2 (git)");
- module::set_version("gallery", 2);
+ module::set_version("gallery", $version = 2);
}
}
@@ -268,16 +270,15 @@ class gallery_installer {
$db->query("DROP TABLE IF EXISTS {access_caches}");
$db->query("DROP TABLE IF EXISTS {access_intents}");
$db->query("DROP TABLE IF EXISTS {graphics_rules}");
+ $db->query("DROP TABLE IF EXISTS {incoming_translations}");
$db->query("DROP TABLE IF EXISTS {items}");
$db->query("DROP TABLE IF EXISTS {logs}");
- $db->query("DROP TABLE IF EXISTS {messages}");
$db->query("DROP TABLE IF EXISTS {modules}");
- $db->query("DROP TABLE IF EXISTS {themes}");
- $db->query("DROP TABLE IF EXISTS {incoming_translations}");
$db->query("DROP TABLE IF EXISTS {outgoing_translations}");
$db->query("DROP TABLE IF EXISTS {permissions}");
$db->query("DROP TABLE IF EXISTS {sessions}");
$db->query("DROP TABLE IF EXISTS {tasks}");
+ $db->query("DROP TABLE IF EXISTS {themes}");
$db->query("DROP TABLE IF EXISTS {vars}");
foreach (array("albums", "resizes", "thumbs", "uploads",
"modules", "logs", "database.php") as $entry) {