Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

check_server_environment.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 4.14 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\install\module\requirements\task;
015   
016  /**
017   * Installer task that checks if the server meats phpBB requirements
018   */
019  class check_server_environment extends \phpbb\install\task_base
020  {
021      /**
022       * @var \phpbb\install\helper\database
023       */
024      protected $database_helper;
025   
026      /**
027       * @var \phpbb\install\helper\iohandler\iohandler_interface
028       */
029      protected $response_helper;
030   
031      /**
032       * @var bool
033       */
034      protected $tests_passed;
035   
036      /**
037       * Constructor
038       *
039       * @param    \phpbb\install\helper\database    $database_helper
040       * @param    \phpbb\install\helper\iohandler\iohandler_interface    $response
041       */
042      public function __construct(\phpbb\install\helper\database $database_helper,
043                                  \phpbb\install\helper\iohandler\iohandler_interface $response)
044      {
045          $this->database_helper    = $database_helper;
046          $this->response_helper    = $response;
047          $this->tests_passed        = true;
048   
049          parent::__construct(true);
050      }
051   
052      /**
053       * {@inheritdoc}
054       */
055      public function run()
056      {
057          //
058          // Check requirements
059          // The error messages should be set in the check_ functions
060          //
061   
062          // Check PHP version
063          $this->check_php_version();
064   
065          // Check for getimagesize()
066          $this->check_image_size();
067   
068          // Check for PCRE support
069          $this->check_pcre();
070   
071          // Check for JSON support
072          $this->check_json();
073   
074          // XML extension support check
075          $this->check_xml();
076   
077          // Check for dbms support
078          $this->check_available_dbms();
079   
080          return $this->tests_passed;
081      }
082   
083      /**
084       * Sets $this->tests_passed
085       *
086       * @param    bool    $is_passed
087       */
088      protected function set_test_passed($is_passed)
089      {
090          // If one test failed, tests_passed should be false
091          $this->tests_passed = (!$this->tests_passed) ? false : $is_passed;
092      }
093   
094      /**
095       * Check if the requirements for PHP version is met
096       */
097      protected function check_php_version()
098      {
099          $php_version = PHP_VERSION;
100   
101          if (version_compare($php_version, '5.4') < 0)
102          {
103              $this->response_helper->add_error_message('PHP_VERSION_REQD', 'PHP_VERSION_REQD_EXPLAIN');
104   
105              $this->set_test_passed(false);
106              return;
107          }
108   
109          $this->set_test_passed(true);
110      }
111   
112      /**
113       * Checks if the installed PHP has getimagesize() available
114       */
115      protected function check_image_size()
116      {
117          if (!@function_exists('getimagesize'))
118          {
119              $this->response_helper->add_error_message('PHP_GETIMAGESIZE_SUPPORT', 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN');
120   
121              $this->set_test_passed(false);
122              return;
123          }
124   
125          $this->set_test_passed(true);
126      }
127   
128      /**
129       * Checks if the installed PHP supports PCRE
130       */
131      protected function check_pcre()
132      {
133          if (@preg_match('//u', ''))
134          {
135              $this->set_test_passed(true);
136              return;
137          }
138   
139          $this->response_helper->add_error_message('PCRE_UTF_SUPPORT', 'PCRE_UTF_SUPPORT_EXPLAIN');
140   
141          $this->set_test_passed(false);
142      }
143   
144      /**
145       * Checks whether PHP's JSON extension is available or not
146       */
147      protected function check_json()
148      {
149          if (@extension_loaded('json'))
150          {
151              $this->set_test_passed(true);
152              return;
153          }
154   
155          $this->response_helper->add_error_message('PHP_JSON_SUPPORT', 'PHP_JSON_SUPPORT_EXPLAIN');
156   
157          $this->set_test_passed(false);
158      }
159   
160      /**
161       * Checks whether or not the XML PHP extension is available (Required by the text formatter)
162       */
163      protected function check_xml()
164      {
165          if (class_exists('DOMDocument'))
166          {
167              $this->set_test_passed(true);
168              return;
169          }
170   
171          $this->response_helper->add_error_message('PHP_XML_SUPPORT', 'PHP_XML_SUPPORT_EXPLAIN');
172   
173          $this->set_test_passed(false);
174      }
175   
176      /**
177       * Check if any supported DBMS is available
178       */
179      protected function check_available_dbms()
180      {
181          $available_dbms = $this->database_helper->get_available_dbms(false, true);
182   
183          if ($available_dbms['ANY_DB_SUPPORT'])
184          {
185              $this->set_test_passed(true);
186              return;
187          }
188   
189          $this->response_helper->add_error_message('PHP_SUPPORTED_DB', 'PHP_SUPPORTED_DB_EXPLAIN');
190   
191          $this->set_test_passed(false);
192      }
193   
194      /**
195       * {@inheritdoc}
196       */
197      static public function get_step_count()
198      {
199          return 0;
200      }
201   
202      /**
203       * {@inheritdoc}
204       */
205      public function get_task_lang_name()
206      {
207          return '';
208      }
209  }
210