Move install over to QuestionHelper

This commit is contained in:
Roeland Jago Douma 2016-09-06 21:08:08 +02:00
parent 25546b6c83
commit b57a1063a3
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
1 changed files with 14 additions and 14 deletions

View File

@ -31,9 +31,11 @@ use InvalidArgumentException;
use OC\Setup; use OC\Setup;
use OCP\IConfig; use OCP\IConfig;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
class Install extends Command { class Install extends Command {
@ -138,24 +140,22 @@ class Install extends Command {
throw new InvalidArgumentException("Database name not provided."); throw new InvalidArgumentException("Database name not provided.");
} }
if (is_null($dbPass)) { if (is_null($dbPass)) {
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */ /** @var QuestionHelper $helper */
$dialog = $this->getHelperSet()->get('dialog'); $helper = $this->getHelper('question');
$dbPass = $dialog->askHiddenResponse( $question = new Question('What is the password to access the database with user <'.$dbUser.'>?');
$output, $question->setHidden(true);
"<question>What is the password to access the database with user <$dbUser>?</question>", $question->setHiddenFallback(false);
false $dbPass = $helper->ask($input, $output, $question);
);
} }
} }
if (is_null($adminPassword)) { if (is_null($adminPassword)) {
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */ /** @var QuestionHelper $helper */
$dialog = $this->getHelperSet()->get('dialog'); $helper = $this->getHelper('question');
$adminPassword = $dialog->askHiddenResponse( $question = new Question('What is the password you like to use for the admin account <'.$adminLogin.'>?');
$output, $question->setHidden(true);
"<question>What is the password you like to use for the admin account <$adminLogin>?</question>", $question->setHiddenFallback(false);
false $adminPassword = $helper->ask($input, $output, $question);
);
} }
$options = [ $options = [