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

archive_download.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 1.91 KiB


 01  <?php
 02  /**
 03   *
 04   * This file is part of the phpBB Forum Software package.
 05   *
 06   * @copyright (c) phpBB Limited <https://www.phpbb.com>
 07   * @license GNU General Public License, version 2 (GPL-2.0)
 08   *
 09   * For full copyright and license information, please see
 10   * the docs/CREDITS.txt file.
 11   *
 12   */
 13   
 14  namespace phpbb\install\controller;
 15   
 16  use phpbb\exception\http_exception;
 17  use phpbb\install\helper\config;
 18  use Symfony\Component\HttpFoundation\BinaryFileResponse;
 19  use Symfony\Component\HttpFoundation\ResponseHeaderBag;
 20   
 21  class archive_download
 22  {
 23      /**
 24       * @var config
 25       */
 26      protected $installer_config;
 27   
 28      /**
 29       * Constructor
 30       *
 31       * @param config $config
 32       */
 33      public function __construct(config $config)
 34      {
 35          $this->installer_config = $config;
 36          $this->installer_config->load_config();
 37      }
 38   
 39      /**
 40       * Sends response with the merge conflict archive
 41       *
 42       * Merge conflicts always have to be resolved manually,
 43       * so we use a different archive for that.
 44       *
 45       * @return BinaryFileResponse
 46       */
 47      public function conflict_archive()
 48      {
 49          $filename = $this->installer_config->get('update_file_conflict_archive', '');
 50   
 51          if (empty($filename))
 52          {
 53              throw new http_exception(404, 'URL_NOT_FOUND');
 54          }
 55   
 56          return $this->send_response($filename);
 57      }
 58   
 59      /**
 60       * Sends response with the updated files' archive
 61       *
 62       * @return BinaryFileResponse
 63       */
 64      public function update_archive()
 65      {
 66          $filename = $this->installer_config->get('update_file_archive', '');
 67   
 68          if (empty($filename))
 69          {
 70              throw new http_exception(404, 'URL_NOT_FOUND');
 71          }
 72   
 73          return $this->send_response($filename);
 74      }
 75   
 76      /**
 77       * Generates a download response
 78       *
 79       * @param string    $filename    Path to the file to download
 80       *
 81       * @return BinaryFileResponse    Response object
 82       */
 83      private function send_response($filename)
 84      {
 85          $response = new BinaryFileResponse($filename);
 86          $response->setContentDisposition(
 87              ResponseHeaderBag::DISPOSITION_ATTACHMENT,
 88              basename($filename)
 89          );
 90   
 91          return $response;
 92      }
 93  }
 94