[Pkg-owncloud-commits] [owncloud] 40/153: Extract schema creation code into its own method.
David Prévot
taffit at moszumanska.debian.org
Tue May 27 03:05:33 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 56b6504d59be62da618ad654e37faedb88f32242
Author: Andreas Fischer <bantu at owncloud.com>
Date: Wed Apr 9 16:46:21 2014 +0200
Extract schema creation code into its own method.
---
core/command/db/converttype.php | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php
index f406148..1701459 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(
--
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