diff options
author | Bart Visscher <bartv@thisnet.nl> | 2013-12-07 15:14:54 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2013-12-07 15:14:54 +0100 |
commit | 731e83c35a11657248f1d73c0a68e74573a1c3e8 (patch) | |
tree | 94f67d4b4d83a272a3b30ecedb40ea1e81495f34 /core/command | |
parent | 22edc42f548a148b323a375ecaf82141f18bc293 (diff) | |
download | nextcloud-server-731e83c35a11657248f1d73c0a68e74573a1c3e8.tar.gz nextcloud-server-731e83c35a11657248f1d73c0a68e74573a1c3e8.zip |
Save the new database config
Diffstat (limited to 'core/command')
-rw-r--r-- | core/command/db/convertfromsqlite.php | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/core/command/db/convertfromsqlite.php b/core/command/db/convertfromsqlite.php index d5003edd6e9..fb11409d2c3 100644 --- a/core/command/db/convertfromsqlite.php +++ b/core/command/db/convertfromsqlite.php @@ -138,12 +138,30 @@ class ConvertFromSqlite extends Command { return; } } - // copy table rows - $tables = array_intersect($toTables, $fromTables); - foreach($tables as $table) { - $output->writeln($table); - $this->copyTable($fromDB, $toDB, $table, $output); + // enable maintenance mode to prevent changes + \OC_Config::setValue('maintenance', true); + try { + // copy table rows + $tables = array_intersect($toTables, $fromTables); + foreach($tables as $table) { + $output->writeln($table); + $this->copyTable($fromDB, $toDB, $table, $output); + } + // save new database config + $dbhost = $hostname; + if ($input->getOption('port')) { + $dbhost = $hostname.':'.$input->getOption('port'); + } + \OC_Config::setValue('dbtype', $type); + \OC_Config::setValue('dbname', $dbname); + \OC_Config::setValue('dbhost', $dbhost); + \OC_Config::setValue('dbuser', $username); + \OC_Config::setValue('dbpassword', $password); + } catch(Exception $e) { + \OC_Config::setValue('maintenance', false); + throw $e; } + \OC_Config::setValue('maintenance', false); } private function getTables($db) { |