summaryrefslogtreecommitdiff
path: root/bin/updatedb.sh
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-01-14 08:44:48 +0100
committerAleksander Machniak <alec@alec.pl>2013-01-14 08:47:21 +0100
commit9be085b2f34e9e42ce9821ffadaca98f989e4364 (patch)
treec0dd86bb36d4d4386ca1184189e72931db4cf1c8 /bin/updatedb.sh
parent4490d03649e1ce1a90274a0dce56fe8e5d2859ae (diff)
Don't attempt to read system table if it doesn't exist
Diffstat (limited to 'bin/updatedb.sh')
-rwxr-xr-xbin/updatedb.sh20
1 files changed, 11 insertions, 9 deletions
diff --git a/bin/updatedb.sh b/bin/updatedb.sh
index 3d37edf61..bc86d0496 100755
--- a/bin/updatedb.sh
+++ b/bin/updatedb.sh
@@ -55,16 +55,18 @@ if (!$DB->is_connected()) {
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');
-
-$row = $DB->fetch_array();
-$version = $row[0];
+// 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];
+}
-// 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