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

update_helper.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 2.30 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\helper;
 015   
 016  /**
 017   * General helper functionality for the updater
 018   */
 019  class update_helper
 020  {
 021      /**
 022       * @var string
 023       */
 024      protected $path_to_new_files;
 025   
 026      /**
 027       * @var string
 028       */
 029      protected $path_to_old_files;
 030   
 031      /**
 032       * @var string
 033       */
 034      protected $phpbb_root_path;
 035   
 036      /**
 037       * Constructor
 038       *
 039       * @param string    $phpbb_root_path
 040       */
 041      public function __construct($phpbb_root_path)
 042      {
 043          $this->phpbb_root_path        = $phpbb_root_path;
 044          $this->path_to_new_files    = $phpbb_root_path . 'install/update/new/';
 045          $this->path_to_old_files    = $phpbb_root_path . 'install/update/old/';
 046      }
 047   
 048      /**
 049       * Returns path to new update files
 050       *
 051       * @return string
 052       */
 053      public function get_path_to_new_update_files()
 054      {
 055          return $this->path_to_new_files;
 056      }
 057   
 058      /**
 059       * Returns path to new update files
 060       *
 061       * @return string
 062       */
 063      public function get_path_to_old_update_files()
 064      {
 065          return $this->path_to_old_files;
 066      }
 067   
 068      /**
 069       * Includes the updated file if available
 070       *
 071       * @param string    $filename    Path to the file relative to phpBB root path
 072       */
 073      public function include_file($filename)
 074      {
 075          if (is_file($this->path_to_new_files . $filename))
 076          {
 077              include_once($this->path_to_new_files . $filename);
 078          }
 079          else if (is_file($this->phpbb_root_path . $filename))
 080          {
 081              include_once($this->phpbb_root_path . $filename);
 082          }
 083      }
 084   
 085      /**
 086       * Customized version_compare()
 087       *
 088       * @param string        $version_number1
 089       * @param string        $version_number2
 090       * @param string|null    $operator
 091       * @return int|bool    The returned value is identical to the PHP build-in function version_compare()
 092       */
 093      public function phpbb_version_compare($version_number1, $version_number2, $operator = null)
 094      {
 095          if ($operator === null)
 096          {
 097              $result = version_compare(
 098                  str_replace('rc', 'RC', strtolower($version_number1)),
 099                  str_replace('rc', 'RC', strtolower($version_number2))
 100              );
 101          }
 102          else
 103          {
 104              $result = version_compare(
 105                  str_replace('rc', 'RC', strtolower($version_number1)),
 106                  str_replace('rc', 'RC', strtolower($version_number2)),
 107                  $operator
 108              );
 109          }
 110   
 111          return $result;
 112      }
 113  }
 114