Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

ftp_file_updater.php

Zuletzt modifiziert: 01.05.2026, 11:26 - Dateigröße: 2.60 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\file_updater;
 015   
 016  use phpbb\install\helper\update_helper;
 017   
 018  /**
 019   * File updater for FTP updates
 020   */
 021  class ftp_file_updater implements file_updater_interface
 022  {
 023      /**
 024       * @var \transfer
 025       */
 026      protected $transfer;
 027   
 028      /**
 029       * @var update_helper
 030       */
 031      protected $update_helper;
 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 update_helper    $update_helper
 047       * @param string        $phpbb_root_path
 048       * @param string        $php_ext
 049       */
 050      public function __construct(update_helper $update_helper, $phpbb_root_path, $php_ext)
 051      {
 052          $this->transfer            = null;
 053          $this->update_helper    = $update_helper;
 054          $this->phpbb_root_path    = $phpbb_root_path;
 055          $this->php_ext            = $php_ext;
 056      }
 057   
 058      /**
 059       * Initialize FTP connection
 060       *
 061       * @param string    $method
 062       * @param string    $host
 063       * @param string    $user
 064       * @param string    $pass
 065       * @param string    $path
 066       * @param int        $port
 067       * @param int        $timeout
 068       */
 069      public function init($method, $host, $user, $pass, $path, $port, $timeout)
 070      {
 071          $this->update_helper->include_file('includes/functions_transfer.' . $this->php_ext);
 072          $this->transfer = new $method($host, $user, $pass, $path, $port, $timeout);
 073          $this->transfer->open_session();
 074      }
 075   
 076      /**
 077       * Close FTP session
 078       */
 079      public function close()
 080      {
 081          $this->transfer->close_session();
 082      }
 083   
 084      /**
 085       * {@inheritdoc}
 086       */
 087      public function delete_file($path_to_file)
 088      {
 089          $this->transfer->delete_file($path_to_file);
 090      }
 091   
 092      /**
 093       * {@inheritdoc}
 094       */
 095      public function create_new_file($path_to_file_to_create, $source, $create_from_content = false)
 096      {
 097          $dirname = dirname($path_to_file_to_create);
 098   
 099          if ($dirname && !file_exists($this->phpbb_root_path . $dirname))
 100          {
 101              $this->transfer->make_dir($dirname);
 102          }
 103   
 104          if ($create_from_content)
 105          {
 106              $this->transfer->write_file($path_to_file_to_create, $source);
 107          }
 108          else
 109          {
 110              $this->transfer->copy_file($path_to_file_to_create, $source);
 111          }
 112      }
 113   
 114      /**
 115       * {@inheritdoc}
 116       */
 117      public function update_file($path_to_file_to_update, $source, $create_from_content = false)
 118      {
 119          if ($create_from_content)
 120          {
 121              $this->transfer->write_file($path_to_file_to_update, $source);
 122          }
 123          else
 124          {
 125              $this->transfer->copy_file($path_to_file_to_update, $source);
 126          }
 127      }
 128   
 129      /**
 130       * {@inheritdoc}
 131       */
 132      public function get_method_name()
 133      {
 134          return 'ftp';
 135      }
 136  }
 137