diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-01-16 12:30:15 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-01-16 12:30:15 +0100 |
commit | c101871d463963fe5426a2db3ba39cb524a96dbd (patch) | |
tree | 70eab60b14062c75ac2be5cd63158030e1a3c508 | |
parent | 9e329c0a275cc0a0ce02d86593c2ee558d846239 (diff) |
Add and use db_table_system config option
-rwxr-xr-x | bin/updatedb.sh | 12 | ||||
-rw-r--r-- | config/db.inc.php.dist | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/bin/updatedb.sh b/bin/updatedb.sh index 017c14913..4b922ea83 100755 --- a/bin/updatedb.sh +++ b/bin/updatedb.sh @@ -55,10 +55,10 @@ if (!$DB->is_connected()) { exit(1); } -// Read DB schema version from database (if system table exists) +// 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') + ." FROM " . $DB->quote_identifier($DB->table_name('system')) ." WHERE " . $DB->quote_identifier('name') ." = ?", $opts['package'] . '-version'); @@ -103,7 +103,7 @@ if (!$version && $opts['version']) { $version = $map[$opts['version']]; } -// Assume last version before the system table was added +// Assume last version before the 'system' table was added if (empty($version)) { $version = 2012080700; } @@ -164,13 +164,15 @@ function update_db_schema($package, $version, $file) return; } - $DB->query("UPDATE " . $DB->quote_identifier('system') + $system_table = $DB->quote_identifier($DB->table_name('system')); + + $DB->query("UPDATE " . $system_table ." SET " . $DB->quote_identifier('value') . " = ?" ." WHERE " . $DB->quote_identifier('name') . " = ?", $version, $package . '-version'); if (!$DB->is_error() && !$DB->affected_rows()) { - $DB->query("INSERT INTO " . $DB->quote_identifier('system') + $DB->query("INSERT INTO " . $system_table ." (" . $DB->quote_identifier('name') . ", " . $DB->quote_identifier('value') . ")" ." VALUES (?, ?)", $package . '-version', $version); diff --git a/config/db.inc.php.dist b/config/db.inc.php.dist index a596d647d..9bbf7d75b 100644 --- a/config/db.inc.php.dist +++ b/config/db.inc.php.dist @@ -49,6 +49,7 @@ $rcmail_config['db_table_cache_thread'] = 'cache_thread'; $rcmail_config['db_table_cache_messages'] = 'cache_messages'; $rcmail_config['db_table_dictionary'] = 'dictionary'; $rcmail_config['db_table_searches'] = 'searches'; +$rcmail_config['db_table_system'] = 'system'; // you can define specific sequence names used in PostgreSQL $rcmail_config['db_sequence_users'] = 'user_ids'; |