mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/12039] Use an abstract class and some more minor adjustments
PHPBB3-12039
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user