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

config.php

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


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  namespace phpbb\db\migration\tool;
 015   
 016  /**
 017  * Migration config tool
 018  */
 019  class config implements \phpbb\db\migration\tool\tool_interface
 020  {
 021      /** @var \phpbb\config\config */
 022      protected $config;
 023   
 024      /**
 025      * Constructor
 026      *
 027      * @param \phpbb\config\config $config
 028      */
 029      public function __construct(\phpbb\config\config $config)
 030      {
 031          $this->config = $config;
 032      }
 033   
 034      /**
 035      * {@inheritdoc}
 036      */
 037      public function get_name()
 038      {
 039          return 'config';
 040      }
 041   
 042      /**
 043      * Add a config setting.
 044      *
 045      * @param string $config_name The name of the config setting
 046      *     you would like to add
 047      * @param mixed $config_value The value of the config setting
 048      * @param bool $is_dynamic True if it is dynamic (changes very often)
 049      *     and should not be stored in the cache, false if not.
 050      * @return null
 051      */
 052      public function add($config_name, $config_value, $is_dynamic = false)
 053      {
 054          if (isset($this->config[$config_name]))
 055          {
 056              return;
 057          }
 058   
 059          $this->config->set($config_name, $config_value, !$is_dynamic);
 060      }
 061   
 062      /**
 063      * Update an existing config setting.
 064      *
 065      * @param string $config_name The name of the config setting you would
 066      *     like to update
 067      * @param mixed $config_value The value of the config setting
 068      * @return null
 069      * @throws \phpbb\db\migration\exception
 070      */
 071      public function update($config_name, $config_value)
 072      {
 073          if (!isset($this->config[$config_name]))
 074          {
 075              throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name);
 076          }
 077   
 078          $this->config->set($config_name, $config_value);
 079      }
 080   
 081      /**
 082      * Update a config setting if the first argument equal to the
 083      * current config value
 084      *
 085      * @param string $compare If equal to the current config value, will be
 086      *     updated to the new config value, otherwise not
 087      * @param string $config_name The name of the config setting you would
 088      *     like to update
 089      * @param mixed $config_value The value of the config setting
 090      * @return null
 091      * @throws \phpbb\db\migration\exception
 092      */
 093      public function update_if_equals($compare, $config_name, $config_value)
 094      {
 095          if (!isset($this->config[$config_name]))
 096          {
 097              throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name);
 098          }
 099   
 100          $this->config->set_atomic($config_name, $compare, $config_value);
 101      }
 102   
 103      /**
 104      * Remove an existing config setting.
 105      *
 106      * @param string $config_name The name of the config setting you would
 107      *     like to remove
 108      * @return null
 109      */
 110      public function remove($config_name)
 111      {
 112          if (!isset($this->config[$config_name]))
 113          {
 114              return;
 115          }
 116   
 117          $this->config->delete($config_name);
 118      }
 119   
 120      /**
 121      * {@inheritdoc}
 122      */
 123      public function reverse()
 124      {
 125          $arguments = func_get_args();
 126          $original_call = array_shift($arguments);
 127   
 128          $call = false;
 129          switch ($original_call)
 130          {
 131              case 'add':
 132                  $call = 'remove';
 133              break;
 134   
 135              case 'remove':
 136                  $call = 'add';
 137                  if (sizeof($arguments) == 1)
 138                  {
 139                      $arguments[] = '';
 140                  }
 141              break;
 142   
 143              case 'update_if_equals':
 144                  $call = 'update_if_equals';
 145   
 146                  // Set to the original value if the current value is what we compared to originally
 147                  $arguments = array(
 148                      $arguments[2],
 149                      $arguments[1],
 150                      $arguments[0],
 151                  );
 152              break;
 153          }
 154   
 155          if ($call)
 156          {
 157              return call_user_func_array(array(&$this, $call), $arguments);
 158          }
 159      }
 160  }
 161