[Pkg-owncloud-commits] [owncloud] 03/153: Save the new database config
David Prévot
taffit at moszumanska.debian.org
Tue May 27 03:05:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 731e83c35a11657248f1d73c0a68e74573a1c3e8
Author: Bart Visscher <bartv at thisnet.nl>
Date: Sat Dec 7 15:14:54 2013 +0100
Save the new database config
---
core/command/db/convertfromsqlite.php | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/core/command/db/convertfromsqlite.php b/core/command/db/convertfromsqlite.php
index d5003ed..fb11409 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) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list