diff --git a/core/command/db/converttype.php b/core/command/db/converttype.php index 370ace7fd0..fb45ab3311 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,