[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

/phpbb/console/command/config/ -> set.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  namespace phpbb\console\command\config;
  14  
  15  use Symfony\Component\Console\Input\InputArgument;
  16  use Symfony\Component\Console\Input\InputInterface;
  17  use Symfony\Component\Console\Input\InputOption;
  18  use Symfony\Component\Console\Output\OutputInterface;
  19  use Symfony\Component\Console\Style\SymfonyStyle;
  20  
  21  class set extends command
  22  {
  23      /**
  24      * {@inheritdoc}
  25      */
  26  	protected function configure()
  27      {
  28          $this
  29              ->setName('config:set')
  30              ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG'))
  31              ->addArgument(
  32                  'key',
  33                  InputArgument::REQUIRED,
  34                  $this->user->lang('CLI_CONFIG_OPTION_NAME')
  35              )
  36              ->addArgument(
  37                  'value',
  38                  InputArgument::REQUIRED,
  39                  $this->user->lang('CLI_CONFIG_NEW')
  40              )
  41              ->addOption(
  42                  'dynamic',
  43                  'd',
  44                  InputOption::VALUE_NONE,
  45                  $this->user->lang('CLI_CONFIG_CANNOT_CACHED')
  46              )
  47          ;
  48      }
  49  
  50      /**
  51      * Executes the command config:set.
  52      *
  53      * Sets a configuration option's value.
  54      *
  55      * @param InputInterface  $input  An InputInterface instance
  56      * @param OutputInterface $output An OutputInterface instance
  57      *
  58      * @return void
  59      * @see \phpbb\config\config::set()
  60      */
  61  	protected function execute(InputInterface $input, OutputInterface $output)
  62      {
  63          $io = new SymfonyStyle($input, $output);
  64  
  65          $key = $input->getArgument('key');
  66          $value = $input->getArgument('value');
  67          $use_cache = !$input->getOption('dynamic');
  68  
  69          $this->config->set($key, $value, $use_cache);
  70  
  71          $io->success($this->user->lang('CLI_CONFIG_SET_SUCCESS', $key));
  72      }
  73  }


Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1