summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-09-01 22:19:44 -0700
committerBharat Mediratta <bharat@menalto.com>2010-09-01 22:19:44 -0700
commit70c8572ea1b421458241b9b3b1cc85cb6bf35057 (patch)
tree821cfa1b1b257ca8623c1777a63531fd4785069d /modules
parentaf3d5acbcd5df6da8e532a009d5be6ba6d1cca0d (diff)
Make RENAME TABLE operations idempotent so that in case there's a
failure of some kind we can restart the upgrade and it'll continue. Fixes ticket #1325.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/gallery_installer.php4
-rw-r--r--modules/rest/helpers/rest_installer.php4
2 files changed, 6 insertions, 2 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index d5264fcc..fa5113bf 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -550,7 +550,9 @@ class gallery_installer {
}
if ($version == 26) {
- $db->query("RENAME TABLE {failed_logins} TO {failed_auths}");
+ if (in_array("failed_logins", Database::instance()->list_tables())) {
+ $db->query("RENAME TABLE {failed_logins} TO {failed_auths}");
+ }
module::set_version("gallery", $version = 27);
}
diff --git a/modules/rest/helpers/rest_installer.php b/modules/rest/helpers/rest_installer.php
index c2694a29..3c7fea4b 100644
--- a/modules/rest/helpers/rest_installer.php
+++ b/modules/rest/helpers/rest_installer.php
@@ -35,7 +35,9 @@ class rest_installer {
static function upgrade($version) {
$db = Database::instance();
if ($version == 1) {
- $db->query("RENAME TABLE {user_access_tokens} TO {user_access_keys}");
+ if (in_array("user_access_tokens", Database::instance()->list_tables())) {
+ $db->query("RENAME TABLE {user_access_tokens} TO {user_access_keys}");
+ }
module::set_version("rest", $version = 2);
}