diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-07 09:23:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-07 09:23:47 +0200 |
commit | 0027304b5fc0a92106dca948b72b6fad04b91299 (patch) | |
tree | fb386fc597d4d4c05b885a4ce283db74a71330fd | |
parent | 74daac49ac4ddfc95b2c90f2784964bf4b8eb2b3 (diff) | |
parent | 59e5ebf330777f39ea9f1e9a12b3a50af1859ed6 (diff) | |
download | nextcloud-server-0027304b5fc0a92106dca948b72b6fad04b91299.tar.gz nextcloud-server-0027304b5fc0a92106dca948b72b6fad04b91299.zip |
Merge pull request #1210 from nextcloud/bump_symfony_console
[3rparty] Bump symfony/console
m--------- | 3rdparty | 0 | ||||
-rw-r--r-- | apps/files_external/lib/Command/Backends.php | 6 | ||||
-rw-r--r-- | apps/files_external/lib/Command/Config.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/Command/Export.php | 4 | ||||
-rw-r--r-- | core/Command/Db/ConvertType.php | 37 | ||||
-rw-r--r-- | core/Command/Maintenance/Install.php | 28 | ||||
-rw-r--r-- | core/Command/User/Add.php | 23 | ||||
-rw-r--r-- | core/Command/User/Report.php | 6 | ||||
-rw-r--r-- | core/Command/User/ResetPassword.php | 28 | ||||
-rw-r--r-- | tests/Core/Command/Config/App/GetConfigTest.php | 4 | ||||
-rw-r--r-- | tests/Core/Command/Config/System/GetConfigTest.php | 4 | ||||
-rw-r--r-- | tests/Core/Command/User/SettingTest.php | 16 |
12 files changed, 73 insertions, 87 deletions
diff --git a/3rdparty b/3rdparty -Subproject 1b3ecc4859174daf3ea39400d689db87e0672e3 +Subproject cb417c7c7795fe2f8b1be5c1d13c0a1b378a033 diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php index b5c1b7f7a54..d05b9fa4a9d 100644 --- a/apps/files_external/lib/Command/Backends.php +++ b/apps/files_external/lib/Command/Backends.php @@ -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 { diff --git a/apps/files_external/lib/Command/Config.php b/apps/files_external/lib/Command/Config.php index cd1c9244d13..362f0a0f2b5 100644 --- a/apps/files_external/lib/Command/Config.php +++ b/apps/files_external/lib/Command/Config.php @@ -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 { diff --git a/apps/files_external/lib/Command/Export.php b/apps/files_external/lib/Command/Export.php index 9e586609d62..722ba38fee3 100644 --- a/apps/files_external/lib/Command/Export.php +++ b/apps/files_external/lib/Command/Export.php @@ -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 { diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index ccf5c0685cb..f8367f75867 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -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('*') diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index 4e84becf770..4b76a1f608c 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -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 = [ diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index a0ca3315154..368f06cba85 100644 --- a/core/Command/User/Add.php +++ b/core/Command/User/Add.php @@ -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>"); diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php index 01eb51f17f9..9a3bd9e5906 100644 --- a/core/Command/User/Report.php +++ b/core/Command/User/Report.php @@ -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() { diff --git a/core/Command/User/ResetPassword.php b/core/Command/User/ResetPassword.php index ed8cf53b990..cf8c894d7a7 100644 --- a/core/Command/User/ResetPassword.php +++ b/core/Command/User/ResetPassword.php @@ -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>"); diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php index 2fac1572e37..7ea3fbb587c 100644 --- a/tests/Core/Command/Config/App/GetConfigTest.php +++ b/tests/Core/Command/Config/App/GetConfigTest.php @@ -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) { diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php index 943cc4cfa40..fd5db69fec9 100644 --- a/tests/Core/Command/Config/System/GetConfigTest.php +++ b/tests/Core/Command/Config/System/GetConfigTest.php @@ -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) { diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php index 56db670657a..784183c72c3 100644 --- a/tests/Core/Command/User/SettingTest.php +++ b/tests/Core/Command/User/SettingTest.php @@ -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') |