Merge pull request #1210 from nextcloud/bump_symfony_console

[3rparty] Bump symfony/console
This commit is contained in:
Joas Schilling 2016-09-07 09:23:47 +02:00 committed by GitHub
commit 0027304b5f
12 changed files with 74 additions and 88 deletions

@ -1 +1 @@
Subproject commit 1b3ecc4859174daf3ea39400d689db87e0672e31
Subproject commit cb417c7c7795fe2f8b1be5c1d13c0a1b378a033a

View File

@ -27,14 +27,8 @@ use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Backend\Backend;
use OCA\Files_External\Lib\DefinitionParameter;
use OCA\Files_External\Service\BackendService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\Input;
use Symfony\Component\Console\Output\OutputInterface;
class Backends extends Base {

View File

@ -27,12 +27,8 @@ use OC\Core\Command\Base;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\GlobalStoragesService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Config extends Base {

View File

@ -22,14 +22,10 @@
namespace OCA\Files_External\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\Input;
use Symfony\Component\Console\Output\OutputInterface;
class Export extends ListCommand {

View File

@ -32,10 +32,14 @@ use \OCP\IConfig;
use OC\DB\Connection;
use OC\DB\ConnectionFactory;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
class ConvertType extends Command {
/**
@ -158,13 +162,12 @@ class ConvertType extends Command {
// Read password by interacting
if ($input->isInteractive()) {
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
$dialog = $this->getHelperSet()->get('dialog');
$password = $dialog->askHiddenResponse(
$output,
'<question>What is the database password?</question>',
false
);
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new Question('What is the database password?');
$question->setHidden(true);
$question->setHiddenFallback(false);
$password = $helper->ask($input, $output, $question);
$input->setOption('password', $password);
return;
}
@ -195,13 +198,12 @@ class ConvertType extends Command {
$output->writeln('<comment>Please note that tables belonging to available but currently not installed apps</comment>');
$output->writeln('<comment>can be included by specifying the --all-apps option.</comment>');
}
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
$dialog = $this->getHelperSet()->get('dialog');
if (!$dialog->askConfirmation(
$output,
'<question>Continue with the conversion (y/n)? [n] </question>',
false
)) {
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false);
if (!$helper->ask($input, $output, $question)) {
return;
}
}
@ -256,9 +258,6 @@ class ConvertType extends Command {
protected function copyTable(Connection $fromDB, Connection $toDB, $table, InputInterface $input, OutputInterface $output) {
$chunkSize = $input->getOption('chunk-size');
/** @var $progress \Symfony\Component\Console\Helper\ProgressHelper */
$progress = $this->getHelperSet()->get('progress');
$query = $fromDB->getQueryBuilder();
$query->automaticTablePrefix(false);
$query->selectAlias($query->createFunction('COUNT(*)'), 'num_entries')
@ -272,11 +271,11 @@ class ConvertType extends Command {
$output->writeln('chunked query, ' . $numChunks . ' chunks');
}
$progress->start($output, $count);
$progress = new ProgressBar($output, $count);
$progress->start();
$redraw = $count > $chunkSize ? 100 : ($count > 100 ? 5 : 1);
$progress->setRedrawFrequency($redraw);
$query = $fromDB->getQueryBuilder();
$query->automaticTablePrefix(false);
$query->select('*')

View File

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

View File

@ -28,6 +28,7 @@ use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@ -94,18 +95,16 @@ class Add extends Command {
return 1;
}
} elseif ($input->isInteractive()) {
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
$dialog = $this->getHelperSet()->get('dialog');
$password = $dialog->askHiddenResponse(
$output,
'<question>Enter password: </question>',
false
);
$confirm = $dialog->askHiddenResponse(
$output,
'<question>Confirm password: </question>',
false
);
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new Question('Enter password: ');
$question->setHidden(true);
$password = $helper->ask($input, $output, $question);
$question = new Question('Confirm password: ');
$question->setHidden(true);
$confirm = $helper->ask($input, $output,$question);
if ($password !== $confirm) {
$output->writeln("<error>Passwords did not match!</error>");

View File

@ -27,6 +27,7 @@ namespace OC\Core\Command\User;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -49,8 +50,7 @@ class Report extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
/** @var \Symfony\Component\Console\Helper\TableHelper $table */
$table = $this->getHelperSet()->get('table');
$table = new Table($output);
$table->setHeaders(array('User Report', ''));
$userCountArray = $this->countUsers();
if(!empty($userCountArray)) {
@ -72,7 +72,7 @@ class Report extends Command {
$rows[] = array('user directories', $userDirectoryCount);
$table->setRows($rows);
$table->render($output);
$table->render();
}
private function countUsers() {

View File

@ -29,10 +29,13 @@ namespace OC\Core\Command\User;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
class ResetPassword extends Command {
@ -79,28 +82,27 @@ class ResetPassword extends Command {
return 1;
}
} elseif ($input->isInteractive()) {
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
$dialog = $this->getHelperSet()->get('dialog');
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
if (\OCP\App::isEnabled('encryption')) {
$output->writeln(
'<error>Warning: Resetting the password when using encryption will result in data loss!</error>'
);
if (!$dialog->askConfirmation($output, '<question>Do you want to continue?</question>', true)) {
$question = new ConfirmationQuestion('Do you want to continue?');
if (!$helper->ask($input, $output, $question)) {
return 1;
}
}
$password = $dialog->askHiddenResponse(
$output,
'<question>Enter a new password: </question>',
false
);
$confirm = $dialog->askHiddenResponse(
$output,
'<question>Confirm the new password: </question>',
false
);
$question = new Question('Enter a new password: ');
$question->setHidden(true);
$password = $helper->ask($input, $output, $question);
$question = new Question('Conform the new password: ');
$question->setHidden(true);
$confirm = $helper->ask($input, $output, $question);
if ($password !== $confirm) {
$output->writeln("<error>Passwords did not match!</error>");

View File

@ -138,8 +138,8 @@ class GetConfigTest extends TestCase {
$this->consoleInput->expects($this->any())
->method('hasParameterOption')
->willReturnMap([
['--output', true],
['--default-value', $hasDefault],
['--output', false, true],
['--default-value', false, $hasDefault],
]);
if ($expectedMessage !== null) {

View File

@ -147,8 +147,8 @@ class GetConfigTest extends TestCase {
$this->consoleInput->expects($this->any())
->method('hasParameterOption')
->willReturnMap([
['--output', true],
['--default-value', $hasDefault],
['--output', false, true],
['--default-value', false,$hasDefault],
]);
if ($expectedMessage !== null) {

View File

@ -99,14 +99,14 @@ class SettingTest extends TestCase {
[
[['uid', 'username'], ['key', 'configkey']],
[['ignore-missing-user', true]],
[['--default-value', true]],
[['--default-value', false, true]],
false,
false,
],
[
[['uid', 'username'], ['key', '']],
[['ignore-missing-user', true]],
[['--default-value', true]],
[['--default-value', false, true]],
false,
'The "default-value" option can only be used when specifying a key.',
],
@ -128,7 +128,7 @@ class SettingTest extends TestCase {
[
[['uid', 'username'], ['key', 'configkey'], ['value', '']],
[['ignore-missing-user', true]],
[['--default-value', true]],
[['--default-value', false, true]],
false,
'The value argument can not be used together with "default-value".',
],
@ -164,7 +164,7 @@ class SettingTest extends TestCase {
[
[['uid', 'username'], ['key', 'configkey']],
[['ignore-missing-user', true], ['delete', true]],
[['--default-value', true]],
[['--default-value', false, true]],
false,
'The "delete" option can not be used together with "default-value".',
],
@ -283,8 +283,8 @@ class SettingTest extends TestCase {
$this->consoleInput->expects($this->atLeastOnce())
->method('hasParameterOption')
->willReturnMap([
['--delete', true],
['--error-if-not-exists', $errorIfNotExists],
['--delete', false, true],
['--error-if-not-exists', false, $errorIfNotExists],
]);
if ($expectedLine === null) {
@ -349,7 +349,7 @@ class SettingTest extends TestCase {
$this->consoleInput->expects($this->atLeastOnce())
->method('hasParameterOption')
->willReturnMap([
['--update-only', $updateOnly],
['--update-only', false, $updateOnly],
]);
if ($expectedLine === null) {
@ -423,7 +423,7 @@ class SettingTest extends TestCase {
$this->consoleInput->expects($this->atLeastOnce())
->method('hasParameterOption')
->willReturnMap([
['--default-value', true],
['--default-value', false, true],
]);
$this->consoleInput->expects($this->once())
->method('getOption')