Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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: 02.04.2025, 15:03 - Dateigröße: 4.50 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 meets 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          // Check for mbstring support
075          $this->check_mbstring();
076   
077          // XML extension support check
078          $this->check_xml();
079   
080          // Check for dbms support
081          $this->check_available_dbms();
082   
083          return $this->tests_passed;
084      }
085   
086      /**
087       * Sets $this->tests_passed
088       *
089       * @param    bool    $is_passed
090       */
091      protected function set_test_passed($is_passed)
092      {
093          // If one test failed, tests_passed should be false
094          $this->tests_passed = (!$this->tests_passed) ? false : $is_passed;
095      }
096   
097      /**
098       * Check if the requirements for PHP version is met
099       */
100      protected function check_php_version()
101      {
102          if (version_compare(PHP_VERSION, '7.2.0', '<'))
103          {
104              $this->response_helper->add_error_message('PHP_VERSION_REQD', 'PHP_VERSION_REQD_EXPLAIN');
105   
106              $this->set_test_passed(false);
107              return;
108          }
109   
110          $this->set_test_passed(true);
111      }
112   
113      /**
114       * Checks if the installed PHP has getimagesize() available
115       */
116      protected function check_image_size()
117      {
118          if (!@function_exists('getimagesize'))
119          {
120              $this->response_helper->add_error_message('PHP_GETIMAGESIZE_SUPPORT', 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN');
121   
122              $this->set_test_passed(false);
123              return;
124          }
125   
126          $this->set_test_passed(true);
127      }
128   
129      /**
130       * Checks if the installed PHP supports PCRE
131       */
132      protected function check_pcre()
133      {
134          if (@preg_match('//u', ''))
135          {
136              $this->set_test_passed(true);
137              return;
138          }
139   
140          $this->response_helper->add_error_message('PCRE_UTF_SUPPORT', 'PCRE_UTF_SUPPORT_EXPLAIN');
141   
142          $this->set_test_passed(false);
143      }
144   
145      /**
146       * Checks whether PHP's JSON extension is available or not
147       */
148      protected function check_json()
149      {
150          if (@extension_loaded('json'))
151          {
152              $this->set_test_passed(true);
153              return;
154          }
155   
156          $this->response_helper->add_error_message('PHP_JSON_SUPPORT', 'PHP_JSON_SUPPORT_EXPLAIN');
157   
158          $this->set_test_passed(false);
159      }
160   
161      /**
162       * Checks whether PHP's mbstring extension is available or not
163       */
164      protected function check_mbstring()
165      {
166          if (@extension_loaded('mbstring'))
167          {
168              $this->set_test_passed(true);
169              return;
170          }
171   
172          $this->response_helper->add_error_message('PHP_MBSTRING_SUPPORT', 'PHP_MBSTRING_SUPPORT_EXPLAIN');
173   
174          $this->set_test_passed(false);
175      }
176   
177      /**
178       * Checks whether or not the XML PHP extension is available (Required by the text formatter)
179       */
180      protected function check_xml()
181      {
182          if (class_exists('DOMDocument'))
183          {
184              $this->set_test_passed(true);
185              return;
186          }
187   
188          $this->response_helper->add_error_message('PHP_XML_SUPPORT', 'PHP_XML_SUPPORT_EXPLAIN');
189   
190          $this->set_test_passed(false);
191      }
192   
193      /**
194       * Check if any supported DBMS is available
195       */
196      protected function check_available_dbms()
197      {
198          $available_dbms = $this->database_helper->get_available_dbms(false, true);
199   
200          if ($available_dbms['ANY_DB_SUPPORT'])
201          {
202              $this->set_test_passed(true);
203              return;
204          }
205   
206          $this->response_helper->add_error_message('PHP_SUPPORTED_DB', 'PHP_SUPPORTED_DB_EXPLAIN');
207   
208          $this->set_test_passed(false);
209      }
210   
211      /**
212       * {@inheritdoc}
213       */
214      static public function get_step_count()
215      {
216          return 0;
217      }
218   
219      /**
220       * {@inheritdoc}
221       */
222      public function get_task_lang_name()
223      {
224          return '';
225      }
226  }
227