diff options
author | Andreas Fischer <bantu@owncloud.com> | 2014-04-15 17:19:47 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@owncloud.com> | 2014-04-15 17:20:31 +0200 |
commit | 6b2876c64dece60eaf43558a476dea5008023388 (patch) | |
tree | b9fd9fcdf83bd6bc68cda44099153ca9187f5bec /core | |
parent | 5fe25868bcfd48cafe0fd569de13a593f6b46738 (diff) | |
download | nextcloud-server-6b2876c64dece60eaf43558a476dea5008023388.tar.gz nextcloud-server-6b2876c64dece60eaf43558a476dea5008023388.zip |
Move (extended) input validation out into validateInput() method.
Diffstat (limited to 'core')
-rw-r--r-- | core/command/db/converttype.php | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php index cf867d93924..1fd546a7a87 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); } |