[ Index ] |
PHP Cross Reference of phpBB-3.2.11-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 14 namespace phpbb\install\console\command\update\config; 15 16 use phpbb\install\helper\iohandler\factory; 17 use phpbb\install\updater_configuration; 18 use phpbb\language\language; 19 use Symfony\Component\Config\Definition\Exception\Exception; 20 use Symfony\Component\Config\Definition\Processor; 21 use Symfony\Component\Console\Input\InputArgument; 22 use Symfony\Component\Console\Input\InputInterface; 23 use Symfony\Component\Console\Output\OutputInterface; 24 use Symfony\Component\Console\Style\SymfonyStyle; 25 use Symfony\Component\Yaml\Exception\ParseException; 26 use Symfony\Component\Yaml\Yaml; 27 28 class show extends \phpbb\console\command\command 29 { 30 /** 31 * @var factory 32 */ 33 protected $iohandler_factory; 34 35 /** 36 * @var language 37 */ 38 protected $language; 39 40 /** 41 * Constructor 42 * 43 * @param language $language 44 * @param factory $factory 45 */ 46 public function __construct(language $language, factory $factory) 47 { 48 $this->iohandler_factory = $factory; 49 $this->language = $language; 50 51 parent::__construct(new \phpbb\user($language, 'datetime')); 52 } 53 54 /** 55 * 56 * {@inheritdoc} 57 */ 58 protected function configure() 59 { 60 $this 61 ->setName('update:config:show') 62 ->addArgument( 63 'config-file', 64 InputArgument::REQUIRED, 65 $this->language->lang('CLI_CONFIG_FILE')) 66 ->setDescription($this->language->lang('CLI_INSTALL_SHOW_CONFIG')) 67 ; 68 } 69 70 /** 71 * Show the validated configuration 72 * 73 * @param InputInterface $input An InputInterface instance 74 * @param OutputInterface $output An OutputInterface instance 75 * 76 * @return null 77 */ 78 protected function execute(InputInterface $input, OutputInterface $output) 79 { 80 $this->iohandler_factory->set_environment('cli'); 81 82 /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ 83 $iohandler = $this->iohandler_factory->get(); 84 $style = new SymfonyStyle($input, $output); 85 $iohandler->set_style($style, $output); 86 87 $config_file = $input->getArgument('config-file'); 88 89 if (!is_file($config_file)) 90 { 91 $iohandler->add_error_message(array('MISSING_FILE', $config_file)); 92 93 return; 94 } 95 96 try 97 { 98 $config = Yaml::parse(file_get_contents($config_file), true, false); 99 } 100 catch (ParseException $e) 101 { 102 $iohandler->add_error_message('INVALID_YAML_FILE'); 103 104 return; 105 } 106 107 $processor = new Processor(); 108 $configuration = new updater_configuration(); 109 110 try 111 { 112 $config = $processor->processConfiguration($configuration, $config); 113 } 114 catch (Exception $e) 115 { 116 $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); 117 118 return; 119 } 120 121 $style->block(Yaml::dump(array('updater' => $config), 10, 4, true, false)); 122 } 123 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |