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/delete.php | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 phpBB/phpbb/console/command/config/delete.php (limited to 'phpBB/phpbb/console/command/config/delete.php') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php new file mode 100644 index 0000000000..1f397904ca --- /dev/null +++ b/phpBB/phpbb/console/command/config/delete.php @@ -0,0 +1,56 @@ +config = $config; + + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('config:delete') + ->setDescription('Sets a configuration option\'s value') + ->addArgument( + 'config-key', + InputArgument::REQUIRED, + 'The configuration option\'s name' + ) + ->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'); + $use_cache = $input->getArgument('use-cache'); + $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + + $this->config->delete($key, $use_cache); + + $output->writeln("Successfully deleted 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/delete.php | 31 ++++++--------------------- 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'phpBB/phpbb/console/command/config/delete.php') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 1f397904ca..2b53f27098 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -10,46 +10,29 @@ 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 delete extends \phpbb\console\command\command +class delete 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:delete') - ->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' - ) - ->addArgument( - 'use-cache', - InputArgument::OPTIONAL, - 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', - true + "The configuration option's name" ) ; } protected function execute(InputInterface $input, OutputInterface $output) { - $key = $input->getArgument('config-key'); - $use_cache = $input->getArgument('use-cache'); - $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + $key = $input->getArgument('key'); - $this->config->delete($key, $use_cache); + $this->config->delete($key); $output->writeln("Successfully deleted config $key"); } -- 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/delete.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/config/delete.php') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 2b53f27098..af3d189445 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -19,7 +19,7 @@ class delete extends command { $this ->setName('config:delete') - ->setDescription("Sets a configuration option's value") + ->setDescription("Deletes a configuration option") ->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/delete.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/config/delete.php') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index af3d189445..5dbeeff20f 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -19,7 +19,7 @@ class delete extends command { $this ->setName('config:delete') - ->setDescription("Deletes a configuration option") + ->setDescription('Deletes a configuration option') ->addArgument( 'key', InputArgument::REQUIRED, -- cgit v1.2.1 From 5d89c283f0dfbce0f615432671628d9d10736334 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jan 2014 23:59:46 +0100 Subject: [ticket/12039] Do not print success message when config did not exist PHPBB3-12039 --- phpBB/phpbb/console/command/config/delete.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command/config/delete.php') diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 5dbeeff20f..9a2d00561d 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -32,8 +32,15 @@ class delete extends command { $key = $input->getArgument('key'); - $this->config->delete($key); + if (isset($this->config[$key])) + { + $this->config->delete($key); - $output->writeln("Successfully deleted config $key"); + $output->writeln("Successfully deleted config $key"); + } + else + { + $output->writeln("Config $key does not exist"); + } } } -- cgit v1.2.1