[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/install/helper/ -> update_helper.php (source)

   1  <?php
   2  /**
   3   *
   4   * This file is part of the phpBB Forum Software package.
   5   *
   6   * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7   * @license GNU General Public License, version 2 (GPL-2.0)
   8   *
   9   * For full copyright and license information, please see
  10   * the docs/CREDITS.txt file.
  11   *
  12   */
  13  
  14  namespace phpbb\install\helper;
  15  
  16  /**
  17   * General helper functionality for the updater
  18   */
  19  class update_helper
  20  {
  21      /**
  22       * @var string
  23       */
  24      protected $path_to_new_files;
  25  
  26      /**
  27       * @var string
  28       */
  29      protected $path_to_old_files;
  30  
  31      /**
  32       * @var string
  33       */
  34      protected $phpbb_root_path;
  35  
  36      /**
  37       * Constructor
  38       *
  39       * @param string    $phpbb_root_path
  40       */
  41  	public function __construct($phpbb_root_path)
  42      {
  43          $this->phpbb_root_path        = $phpbb_root_path;
  44          $this->path_to_new_files    = $phpbb_root_path . 'install/update/new/';
  45          $this->path_to_old_files    = $phpbb_root_path . 'install/update/old/';
  46      }
  47  
  48      /**
  49       * Returns path to new update files
  50       *
  51       * @return string
  52       */
  53  	public function get_path_to_new_update_files()
  54      {
  55          return $this->path_to_new_files;
  56      }
  57  
  58      /**
  59       * Returns path to new update files
  60       *
  61       * @return string
  62       */
  63  	public function get_path_to_old_update_files()
  64      {
  65          return $this->path_to_old_files;
  66      }
  67  
  68      /**
  69       * Includes the updated file if available
  70       *
  71       * @param string    $filename    Path to the file relative to phpBB root path
  72       */
  73  	public function include_file($filename)
  74      {
  75          if (is_file($this->path_to_new_files . $filename))
  76          {
  77              include_once($this->path_to_new_files . $filename);
  78          }
  79          else if (is_file($this->phpbb_root_path . $filename))
  80          {
  81              include_once($this->phpbb_root_path . $filename);
  82          }
  83      }
  84  
  85      /**
  86       * Customized version_compare()
  87       *
  88       * @param string        $version_number1
  89       * @param string        $version_number2
  90       * @param string|null    $operator
  91       * @return int|bool    The returned value is identical to the PHP build-in function version_compare()
  92       */
  93  	public function phpbb_version_compare($version_number1, $version_number2, $operator = null)
  94      {
  95          if ($operator === null)
  96          {
  97              $result = version_compare(
  98                  str_replace('rc', 'RC', strtolower($version_number1)),
  99                  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  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1