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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
obtain_update_files.php
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\obtain_data\task;
015
016 use phpbb\install\exception\user_interaction_required_exception;
017 use phpbb\install\helper\config;
018 use phpbb\install\helper\iohandler\iohandler_interface;
019 use phpbb\install\task_base;
020
021 class obtain_update_files extends task_base
022 {
023 /**
024 * @var config
025 */
026 protected $installer_config;
027
028 /**
029 * @var iohandler_interface
030 */
031 protected $iohandler;
032
033 /**
034 * @var string
035 */
036 protected $phpbb_root_path;
037
038 /**
039 * @var string
040 */
041 protected $php_ext;
042
043 /**
044 * Constructor
045 *
046 * @param config $config
047 * @param iohandler_interface $iohandler
048 * @param string $phpbb_root_path
049 * @param string $php_ext
050 */
051 public function __construct(config $config, iohandler_interface $iohandler, $phpbb_root_path, $php_ext)
052 {
053 $this->installer_config = $config;
054 $this->iohandler = $iohandler;
055 $this->phpbb_root_path = $phpbb_root_path;
056 $this->php_ext = $php_ext;
057
058 parent::__construct(false);
059 }
060
061 /**
062 * {@inheritdoc}
063 */
064 public function check_requirements()
065 {
066 return $this->installer_config->get('do_update_files', false);
067 }
068
069 /**
070 * {@inheritdoc}
071 */
072 public function run()
073 {
074 // Load update info file
075 // The file should be checked in the requirements, so we assume that it exists
076 $update_info_file = $this->phpbb_root_path . 'install/update/index.' . $this->php_ext;
077 include($update_info_file);
078 $info = (empty($update_info) || !is_array($update_info)) ? false : $update_info;
079
080 // If the file is invalid, abort mission
081 if (!$info)
082 {
083 $this->iohandler->add_error_message('WRONG_INFO_FILE_FORMAT');
084 throw new user_interaction_required_exception();
085 }
086
087 // Replace .php with $this->php_ext if needed
088 if ($this->php_ext !== 'php')
089 {
090 $custom_extension = '.' . $this->php_ext;
091 $info['files'] = preg_replace('#\.php$#i', $custom_extension, $info['files']);
092 }
093
094 // Save update info
095 $this->installer_config->set('update_info_unprocessed', $info);
096 }
097
098 /**
099 * {@inheritdoc}
100 */
101 static public function get_step_count()
102 {
103 return 0;
104 }
105
106 /**
107 * {@inheritdoc}
108 */
109 public function get_task_lang_name()
110 {
111 return '';
112 }
113 }
114