diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2013-11-27 14:16:34 +0100 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2013-11-27 14:16:34 +0100 |
| commit | e6749261f1797cd4bb9b93398ed92ae5d9c32b26 (patch) | |
| tree | 47ad5a6e1c67e692be4638a16b2dca09def14c68 /phpBB/phpbb/console/command/config/set_atomic.php | |
| parent | d5743f008d9221f4199570fb0a6cb63d0cf88038 (diff) | |
| download | forums-e6749261f1797cd4bb9b93398ed92ae5d9c32b26.tar forums-e6749261f1797cd4bb9b93398ed92ae5d9c32b26.tar.gz forums-e6749261f1797cd4bb9b93398ed92ae5d9c32b26.tar.bz2 forums-e6749261f1797cd4bb9b93398ed92ae5d9c32b26.tar.xz forums-e6749261f1797cd4bb9b93398ed92ae5d9c32b26.zip | |
[ticket/12039] Use an abstract class and some more minor adjustments
PHPBB3-12039
Diffstat (limited to 'phpBB/phpbb/console/command/config/set_atomic.php')
| -rw-r--r-- | phpBB/phpbb/console/command/config/set_atomic.php | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index 17583c89de..1393549a1e 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -10,56 +10,46 @@ 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 set_atomic extends \phpbb\console\command\command +class set_atomic 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:set-atomic') - ->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( - 'old-value', + 'old', InputArgument::REQUIRED, - 'Current configuration value' + 'Current configuration value, use 0 and 1 to specify boolean values' ) ->addArgument( - 'new-value', + 'new', InputArgument::REQUIRED, - 'New configuration value' + 'New configuration value, use 0 and 1 to specify boolean values' ) - ->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'); - $old_value = $input->getArgument('old-value'); - $new_value = $input->getArgument('new-value'); - $use_cache = $input->getArgument('use-cache'); - $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); + $key = $input->getArgument('key'); + $old_value = $input->getArgument('old'); + $new_value = $input->getArgument('new'); + $use_cache = !$input->getOption('dynamic'); if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) { |
