Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

set_atomic.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 2.15 KiB


01  <?php
02  /**
03  *
04  * This file is part of the phpBB Forum Software package.
05  *
06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
07  * @license GNU General Public License, version 2 (GPL-2.0)
08  *
09  * 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  }
85