From 9be085b2f34e9e42ce9821ffadaca98f989e4364 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 14 Jan 2013 02:47:21 -0500
Subject: [PATCH] Don't attempt to read system table if it doesn't exist
---
bin/updatedb.sh | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/bin/updatedb.sh b/bin/updatedb.sh
index 3d37edf..bc86d04 100755
--- a/bin/updatedb.sh
+++ b/bin/updatedb.sh
@@ -55,16 +55,18 @@
exit(1);
}
-// Read DB schema version from database
-$DB->query("SELECT " . $DB->quote_identifier('value')
- ." FROM " . $DB->quote_identifier('system')
- ." WHERE " . $DB->quote_identifier('name') ." = ?",
- $opts['label'] . '-version');
+// Read DB schema version from database (if system table exists)
+if (in_array('system', (array)$DB->list_tables())) {
+ $DB->query("SELECT " . $DB->quote_identifier('value')
+ ." FROM " . $DB->quote_identifier('system')
+ ." WHERE " . $DB->quote_identifier('name') ." = ?",
+ $opts['label'] . '-version');
-$row = $DB->fetch_array();
-$version = $row[0];
+ $row = $DB->fetch_array();
+ $version = $row[0];
+}
-// no DB version, but release version is specified
+// DB version not found, but release version is specified
if (!$version && $opts['version']) {
// Map old release version string to DB schema version
// Note: This is for backward compat. only, do not need to be updated
--
Gitblit v1.9.1