From d5743f008d9221f4199570fb0a6cb63d0cf88038 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 26 Nov 2013 18:11:54 +0100 Subject: [ticket/12039] Add config:* to the command line interface tool PHPBB3-12039 --- phpBB/phpbb/console/command/config/increment.php | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 phpBB/phpbb/console/command/config/increment.php (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php new file mode 100644 index 0000000000..0974d34cc5 --- /dev/null +++ b/phpBB/phpbb/console/command/config/increment.php @@ -0,0 +1,62 @@ +config = $config; + + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('config:increment') + ->setDescription('Sets a configuration option\'s value') + ->addArgument( + 'config-key', + InputArgument::REQUIRED, + 'The configuration option\'s name' + ) + ->addArgument( + 'increment', + InputArgument::REQUIRED, + 'Amount to increment by' + ) + ->addArgument( + 'use-cache', + InputArgument::OPTIONAL, + 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', + true + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $key = $input->getArgument('config-key'); + $increment = $input->getArgument('increment'); + $use_cache = $input->getArgument('use-cache'); + $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + + $this->config->increment($key, $increment, $use_cache); + + $output->writeln("Successfully incremented config $key"); + } +} -- cgit v1.2.1 From e6749261f1797cd4bb9b93398ed92ae5d9c32b26 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 27 Nov 2013 14:16:34 +0100 Subject: [ticket/12039] Use an abstract class and some more minor adjustments PHPBB3-12039 --- phpBB/phpbb/console/command/config/increment.php | 34 +++++++++--------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 0974d34cc5..06b2772230 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -10,50 +10,40 @@ namespace phpbb\console\command\config; 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 increment extends \phpbb\console\command\command +class increment extends command { - /** @var \phpbb\config\config */ - protected $config; - - function __construct(\phpbb\config\config $config) - { - $this->config = $config; - - parent::__construct(); - } - protected function configure() { $this ->setName('config:increment') - ->setDescription('Sets a configuration option\'s value') + ->setDescription("Sets a configuration option's value") ->addArgument( - 'config-key', + 'key', InputArgument::REQUIRED, - 'The configuration option\'s name' + "The configuration option's name" ) ->addArgument( 'increment', InputArgument::REQUIRED, 'Amount to increment by' ) - ->addArgument( - 'use-cache', - InputArgument::OPTIONAL, - 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', - true + ->addOption( + 'dynamic', + 'd', + InputOption::VALUE_NONE, + 'Set this option if the configuration option changes too frequently to be efficiently cached.' ) ; } protected function execute(InputInterface $input, OutputInterface $output) { - $key = $input->getArgument('config-key'); + $key = $input->getArgument('key'); $increment = $input->getArgument('increment'); - $use_cache = $input->getArgument('use-cache'); - $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + $use_cache = !$input->getOption('dynamic'); $this->config->increment($key, $increment, $use_cache); -- cgit v1.2.1 From de727b80e285970c0e770c8597c6b56adb513a4d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 27 Nov 2013 15:16:40 +0100 Subject: [ticket/12039] Fix option descriptions PHPBB3-12039 --- phpBB/phpbb/console/command/config/increment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 06b2772230..5f5d03b50b 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -19,7 +19,7 @@ class increment extends command { $this ->setName('config:increment') - ->setDescription("Sets a configuration option's value") + ->setDescription("Increment a configuration option's value") ->addArgument( 'key', InputArgument::REQUIRED, -- cgit v1.2.1 From 98200161fc642ce447395a4b8db3b1a3c674c734 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 26 Dec 2013 19:03:43 +0100 Subject: [ticket/12039] Update command descriptions PHPBB3-12039 --- phpBB/phpbb/console/command/config/increment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 5f5d03b50b..bc6b63c6ff 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -19,7 +19,7 @@ class increment extends command { $this ->setName('config:increment') - ->setDescription("Increment a configuration option's value") + ->setDescription("Increments a configuration option's value") ->addArgument( 'key', InputArgument::REQUIRED, -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- phpBB/phpbb/console/command/config/increment.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index bc6b63c6ff..64b5d42b9d 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ namespace phpbb\console\command\config; -- cgit v1.2.1 From 413754af1f2d10aae366f8255d0d91ec7e6fd878 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 15 Jun 2014 12:19:24 +0200 Subject: [ticket/12715] Update console command config:* comments PHPBB3-12715 --- phpBB/phpbb/console/command/config/increment.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 64b5d42b9d..21f0660e61 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -19,6 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface; class increment extends command { + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -43,6 +46,17 @@ class increment extends command ; } + /** + * Executes the command config:increment. + * + * Increments an integer configuration value. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return null + * @see \phpbb\config\config::increment() + */ protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); -- cgit v1.2.1 From 4092b63be39453f9a7ce4f985217099ab10aae90 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 23 Jul 2014 00:35:09 +0530 Subject: [ticket/12656] Use lang keys for CLI command descriptions PHPBB3-12656 --- phpBB/phpbb/console/command/config/increment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 21f0660e61..a77b3ab912 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -26,7 +26,7 @@ class increment extends command { $this ->setName('config:increment') - ->setDescription("Increments a configuration option's value") + ->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG')) ->addArgument( 'key', InputArgument::REQUIRED, -- cgit v1.2.1 From c81438e1f85633dd770fcddd8e332b278338732f Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 23 Jul 2014 01:23:44 +0530 Subject: [ticket/12656] Use lang keys for all CLI strings PHPBB3-12656 --- phpBB/phpbb/console/command/config/increment.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index a77b3ab912..0c25075ce8 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -30,18 +30,18 @@ class increment extends command ->addArgument( 'key', InputArgument::REQUIRED, - "The configuration option's name" + $this->user->lang('CLI_CONFIG_OPTION_NAME') ) ->addArgument( 'increment', InputArgument::REQUIRED, - 'Amount to increment by' + $this->user->lang('CLI_CONFIG_INCREMENT_BY') ) ->addOption( 'dynamic', 'd', InputOption::VALUE_NONE, - 'Set this option if the configuration option changes too frequently to be efficiently cached.' + $this->user-lang('CLI_CONFIG_CANNOT_CACHED') ) ; } @@ -65,6 +65,6 @@ class increment extends command $this->config->increment($key, $increment, $use_cache); - $output->writeln("Successfully incremented config $key"); + $output->writeln('' . $this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key) . ''); } } -- cgit v1.2.1 From cf93b7e367bb8c47e9cbec8e87ccb2e64387175a Mon Sep 17 00:00:00 2001 From: n-aleha Date: Sun, 3 Aug 2014 08:34:25 +0300 Subject: [ticket/12908] Fix operator typo in increment.php PHPBB3-12908 --- phpBB/phpbb/console/command/config/increment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/config/increment.php') diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 0c25075ce8..b4d7438b66 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -41,7 +41,7 @@ class increment extends command 'dynamic', 'd', InputOption::VALUE_NONE, - $this->user-lang('CLI_CONFIG_CANNOT_CACHED') + $this->user->lang('CLI_CONFIG_CANNOT_CACHED') ) ; } -- cgit v1.2.1