[Pkg-owncloud-commits] [owncloud] 51/153: Move (extended) input validation out into validateInput() method.

David Prévot taffit at moszumanska.debian.org
Tue May 27 03:05:34 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 6b2876c64dece60eaf43558a476dea5008023388
Author: Andreas Fischer <bantu at owncloud.com>
Date:   Tue Apr 15 17:19:47 2014 +0200

    Move (extended) input validation out into validateInput() method.
---
 core/command/db/converttype.php | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php
index cf867d9..1fd546a 100644
--- a/core/command/db/converttype.php
+++ b/core/command/db/converttype.php
@@ -108,7 +108,7 @@ class ConvertType extends Command {
 		;
 	}
 
-	protected function execute(InputInterface $input, OutputInterface $output) {
+	protected function validateInput(InputInterface $input, OutputInterface $output) {
 		$type = $input->getArgument('type');
 		if ($this->connectionFactory->normalizeType($type) === 'sqlite3') {
 			$output->writeln(sprintf(
@@ -124,22 +124,29 @@ class ConvertType extends Command {
 			));
 			return 1;
 		}
+		if ($type === 'oci' && $input->getOption('clear-schema')) {
+			// Doctrine unconditionally tries (at least in version 2.3)
+			// to drop sequence triggers when dropping a table, even though
+			// such triggers may not exist. This results in errors like
+			// "ORA-04080: trigger 'OC_STORAGES_AI_PK' does not exist".
+			$output->writeln(sprintf(
+				'<error>The --clear-schema option is not supported when converting to Oracle (oci).</error>',
+				$type
+			));
+			return 1;
+		}
+	}
+
+	protected function execute(InputInterface $input, OutputInterface $output) {
+		$inputError = $this->validateInput($input, $output);
+		if ($inputError) {
+			return $inputError;
+		}
 
 		$fromDB = \OC_DB::getConnection();
 		$toDB = $this->getToDBConnection($input, $output);
 
 		if ($input->getOption('clear-schema')) {
-			if ($type === 'oci') {
-				// Doctrine unconditionally tries (at least in version 2.3)
-				// to drop sequence triggers when dropping a table, even though
-				// such triggers may not exist. This results in errors like
-				// "ORA-04080: trigger 'OC_STORAGES_AI_PK' does not exist".
-				$output->writeln(sprintf(
-					'<error>The --clear-schema option is not supported when converting to Oracle (oci).</error>',
-					$type
-				));
-				return 1;
-			}
 			$this->clearSchema($toDB->getSchemaManager(), $input, $output);
 		}
 

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