[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
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 20 class set_atomic extends command 21 { 22 /** 23 * {@inheritdoc} 24 */ 25 protected function configure() 26 { 27 $this 28 ->setName('config:set-atomic') 29 ->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG')) 30 ->addArgument( 31 'key', 32 InputArgument::REQUIRED, 33 $this->user->lang('CLI_CONFIG_OPTION_NAME') 34 ) 35 ->addArgument( 36 'old', 37 InputArgument::REQUIRED, 38 $this->user->lang('CLI_CONFIG_CURRENT') 39 ) 40 ->addArgument( 41 'new', 42 InputArgument::REQUIRED, 43 $this->user->lang('CLI_CONFIG_NEW') 44 ) 45 ->addOption( 46 'dynamic', 47 'd', 48 InputOption::VALUE_NONE, 49 $this->user->lang('CLI_CONFIG_CANNOT_CACHED') 50 ) 51 ; 52 } 53 54 /** 55 * Executes the command config:set-atomic. 56 * 57 * Sets a configuration option's value only if the old_value matches the 58 * current configuration value or the configuration value does not exist yet. 59 * 60 * @param InputInterface $input An InputInterface instance 61 * @param OutputInterface $output An OutputInterface instance 62 * 63 * @return bool True if the value was changed, false otherwise. 64 * @see \phpbb\config\config::set_atomic() 65 */ 66 protected function execute(InputInterface $input, OutputInterface $output) 67 { 68 $key = $input->getArgument('key'); 69 $old_value = $input->getArgument('old'); 70 $new_value = $input->getArgument('new'); 71 $use_cache = !$input->getOption('dynamic'); 72 73 if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) 74 { 75 $output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>'); 76 return 0; 77 } 78 else 79 { 80 $output->writeln('<error>' . $this->user->lang('CLI_CONFIG_SET_FAILURE', $key) . '</error>'); 81 return 1; 82 } 83 } 84 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |