summaryrefslogtreecommitdiffstats
path: root/core/command
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2014-04-09 16:46:21 +0200
committerAndreas Fischer <bantu@owncloud.com>2014-04-09 16:46:21 +0200
commit56b6504d59be62da618ad654e37faedb88f32242 (patch)
tree2a80382f1be70ebd3aaa2a83ce6348b78fb4641d /core/command
parent370593361b89063d7bd65c018ccd537d0ea1c0ab (diff)
downloadnextcloud-server-56b6504d59be62da618ad654e37faedb88f32242.tar.gz
nextcloud-server-56b6504d59be62da618ad654e37faedb88f32242.zip
Extract schema creation code into its own method.
Diffstat (limited to 'core/command')
-rw-r--r--core/command/db/converttype.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php
index f406148ebd5..170145940d3 100644
--- a/core/command/db/converttype.php
+++ b/core/command/db/converttype.php
@@ -123,15 +123,7 @@ class ConvertType extends Command {
$this->clearSchema($toDB->getSchemaManager(), $input, $output);
}
- $output->writeln('<info>Creating schema in new database</info>');
- $schemaManager = new \OC\DB\MDB2SchemaManager($toDB);
- $schemaManager->createDbFromStructure(\OC::$SERVERROOT.'/db_structure.xml');
- $apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps();
- foreach($apps as $app) {
- if(file_exists(\OC_App::getAppPath($app).'/appinfo/database.xml')) {
- $schemaManager->createDbFromStructure(\OC_App::getAppPath($app).'/appinfo/database.xml');
- }
- }
+ $this->createSchema($toDB, $input, $output);
$toTables = $this->getTables($toDB);
$fromTables = $this->getTables($fromDB);
@@ -154,6 +146,18 @@ class ConvertType extends Command {
$this->convertDB($fromDB, $toDB, $tables, $input, $output);
}
+ protected function createSchema(Connection $toDB, InputInterface $input, OutputInterface $output) {
+ $output->writeln('<info>Creating schema in new database</info>');
+ $schemaManager = new \OC\DB\MDB2SchemaManager($toDB);
+ $schemaManager->createDbFromStructure(\OC::$SERVERROOT.'/db_structure.xml');
+ $apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps();
+ foreach($apps as $app) {
+ if (file_exists(\OC_App::getAppPath($app).'/appinfo/database.xml')) {
+ $schemaManager->createDbFromStructure(\OC_App::getAppPath($app).'/appinfo/database.xml');
+ }
+ }
+ }
+
protected function getToDBConnection(InputInterface $input, OutputInterface $output) {
$type = $input->getArgument('type');
$connectionParams = array(