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

show_file_status.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 4.37 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\update_filesystem\task;
015   
016  use phpbb\filesystem\filesystem;
017  use phpbb\install\exception\user_interaction_required_exception;
018  use phpbb\install\helper\config;
019  use phpbb\install\helper\container_factory;
020  use phpbb\install\helper\file_updater\factory;
021  use phpbb\install\helper\iohandler\iohandler_interface;
022  use phpbb\install\task_base;
023   
024  class show_file_status extends task_base
025  {
026      /**
027       * @var \phpbb\cache\driver\driver_interface
028       */
029      protected $cache;
030   
031      /**
032       * @var filesystem
033       */
034      protected $filesystem;
035   
036      /**
037       * @var config
038       */
039      protected $installer_config;
040   
041      /**
042       * @var iohandler_interface
043       */
044      protected $iohandler;
045   
046      /**
047       * @var \phpbb\install\helper\file_updater\compression_file_updater
048       */
049      protected $file_updater;
050   
051      /**
052       * Constructor
053       *
054       * @param container_factory        $container
055       * @param config                $config
056       * @param iohandler_interface    $iohandler
057       * @param filesystem            $filesystem
058       * @param factory                $file_updater_factory
059       */
060      public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, filesystem $filesystem, factory $file_updater_factory)
061      {
062          $this->installer_config    = $config;
063          $this->iohandler        = $iohandler;
064          $this->filesystem        = $filesystem;
065   
066          $this->cache = $container->get('cache.driver');
067   
068          // Initialize compression file updater
069          $this->file_updater = $file_updater_factory->get('compression');
070   
071          parent::__construct(false);
072      }
073   
074      /**
075       * {@inheritdoc}
076       */
077      public function check_requirements()
078      {
079          return $this->installer_config->get('do_update_files', false);
080      }
081   
082      /**
083       * {@inheritdoc}
084       */
085      public function run()
086      {
087          if (!$this->iohandler->get_input('submit_continue_file_update', false))
088          {
089              // Handle merge conflicts
090              $merge_conflicts = $this->installer_config->get('merge_conflict_list', array());
091   
092              // Create archive for merge conflicts
093              if (!empty($merge_conflicts))
094              {
095                  $compression_method = $this->installer_config->get('file_update_compression', '');
096                  $conflict_archive = $this->file_updater->init($compression_method);
097                  $this->installer_config->set('update_file_conflict_archive', $conflict_archive);
098   
099                  foreach ($merge_conflicts as $filename)
100                  {
101                      $this->file_updater->create_new_file(
102                          $filename,
103                          base64_decode($this->cache->get('_file_' . md5($filename))),
104                          true
105                      );
106                  }
107   
108                  // Render download box
109                  $this->iohandler->add_download_link(
110                      'phpbb_installer_update_conflict_download',
111                      'DOWNLOAD_CONFLICTS',
112                      'DOWNLOAD_CONFLICTS_EXPLAIN'
113                  );
114   
115                  $this->file_updater->close();
116              }
117   
118              // Render update file statuses
119              $file_update_info = $this->installer_config->get('update_files', array());
120              $file_status = array(
121                  'deleted'        => (!isset($file_update_info['delete'])) ? array() : $file_update_info['delete'],
122                  'new'            => (!isset($file_update_info['new'])) ? array() : $file_update_info['new'],
123                  'conflict'        => $this->installer_config->get('merge_conflict_list', array()),
124                  'modified'        => (!isset($file_update_info['update_with_diff'])) ? array() : $file_update_info['update_with_diff'],
125                  'not_modified'    => (!isset($file_update_info['update_without_diff'])) ? array() : $file_update_info['update_without_diff'],
126              );
127   
128              $this->iohandler->render_update_file_status($file_status);
129   
130              // Add form to continue update
131              $this->iohandler->add_user_form_group('UPDATE_CONTINUE_FILE_UPDATE', array(
132                  'submit_continue_file_update' => array(
133                      'label' => 'UPDATE_CONTINUE_FILE_UPDATE',
134                      'type' => 'submit',
135                  ),
136              ));
137   
138              // Show results to the user
139              throw new user_interaction_required_exception();
140          }
141          else
142          {
143              $conflict_archive_path = $this->installer_config->get('update_file_conflict_archive', null);
144   
145              // Remove archive
146              if ($conflict_archive_path !== null && $this->filesystem->exists($conflict_archive_path))
147              {
148                  $this->filesystem->remove($conflict_archive_path);
149              }
150   
151              $this->installer_config->set('update_file_conflict_archive', null);
152          }
153      }
154   
155      /**
156       * {@inheritdoc}
157       */
158      static public function get_step_count()
159      {
160          return 0;
161      }
162   
163      /**
164       * {@inheritdoc}
165       */
166      public function get_task_lang_name()
167      {
168          return '';
169      }
170  }
171