diff options
author | Bart Visscher <bartv@thisnet.nl> | 2014-02-17 18:09:42 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2014-02-17 18:09:42 +0100 |
commit | 8a6dcdf4a47fb45d417ca1fd2aec2901c247d16f (patch) | |
tree | be79030dd593074dbe405654bdc95e54643f621a | |
parent | bcb78e48b283def05d21defaf554f5ce7c578c56 (diff) | |
download | nextcloud-server-8a6dcdf4a47fb45d417ca1fd2aec2901c247d16f.tar.gz nextcloud-server-8a6dcdf4a47fb45d417ca1fd2aec2901c247d16f.zip |
Move password interaction to interact function
-rw-r--r-- | core/command/db/converttype.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php index 370ace7fd0c..fb45ab33113 100644 --- a/core/command/db/converttype.php +++ b/core/command/db/converttype.php @@ -29,6 +29,19 @@ class ConvertType extends Command { parent::__construct(); } + protected function interact(InputInterface $input, OutputInterface $output) { + parent::interact($input, $output); + if (!$input->getOption('password')) { + $dialog = $this->getHelperSet()->get('dialog'); + $password = $dialog->askHiddenResponse( + $output, + 'What is the database password?', + false + ); + $input->setOption('password', $password); + } + } + protected function configure() { $this ->setName('db:convert-type') @@ -137,22 +150,11 @@ class ConvertType extends Command { $username = $input->getArgument('username'); $hostname = $input->getArgument('hostname'); $dbname = $input->getArgument('database'); + $password = $input->getOption('password'); if (!isset(self::$type2driver[$type])) { throw new InvalidArgumentException('Unknown type: '.$type); } - if ($input->getOption('password')) { - $password = $input->getOption('password'); - } else { - // TODO: should be moved to the interact function - $dialog = $this->getHelperSet()->get('dialog'); - $password = $dialog->askHiddenResponse( - $output, - 'What is the database password?', - false - ); - $input->setOption('password', $password); - } $connectionParams = array( 'driver' => self::$type2driver[$type], 'user' => $username, |