[Pkg-owncloud-commits] [owncloud] 37/153: Move schema clearing to extra method.

David Prévot taffit at moszumanska.debian.org
Tue May 27 03:05:32 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 03a3f668676486644a12261eba7e33f227ea960d
Author: Andreas Fischer <bantu at owncloud.com>
Date:   Wed Apr 9 15:45:30 2014 +0200

    Move schema clearing to extra method.
---
 core/command/db/converttype.php | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php
index 81a89de..7e65d1f 100644
--- a/core/command/db/converttype.php
+++ b/core/command/db/converttype.php
@@ -9,6 +9,8 @@
 
 namespace OC\Core\Command\Db;
 
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
+
 use OC\Config;
 use OC\DB\Connection;
 use OC\DB\ConnectionFactory;
@@ -104,14 +106,7 @@ class ConvertType extends Command {
 		$toDB = $this->getToDBConnection($input, $output);
 
 		if ($input->getOption('clear-schema')) {
-			$schemaManager = $toDB->getSchemaManager();
-			$toTables = $schemaManager->listTableNames();
-			if (!empty($toTables)) {
-				$output->writeln('<info>Clearing schema in new database</info>');
-			}
-			foreach($toTables as $table) {
-				$schemaManager->dropTable($table);
-			}
+			$this->clearSchema($toDB->getSchemaManager(), $input, $output);
 		}
 
 		$output->writeln('<info>Creating schema in new database</info>');
@@ -160,6 +155,16 @@ class ConvertType extends Command {
 		return $this->connectionFactory->getConnection($type, $connectionParams);
 	}
 
+	protected function clearSchema(AbstractSchemaManager $schemaManager, InputInterface $input, OutputInterface $output) {
+		$toTables = $schemaManager->listTableNames();
+		if (!empty($toTables)) {
+			$output->writeln('<info>Clearing schema in new database</info>');
+		}
+		foreach($toTables as $table) {
+			$schemaManager->dropTable($table);
+		}
+	}
+
 	protected function getTables(Connection $db) {
 		$schemaManager = $db->getSchemaManager();
 		return $schemaManager->listTableNames();

-- 
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