[ Index ]

PHP Cross Reference of phpBB-3.2.8-deutsch

title

Body

[close]

/phpbb/install/module/update_filesystem/task/ -> download_updated_files.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\module\update_filesystem\task;
  15  
  16  use phpbb\filesystem\filesystem;
  17  use phpbb\install\exception\jump_to_restart_point_exception;
  18  use phpbb\install\exception\user_interaction_required_exception;
  19  use phpbb\install\helper\config;
  20  use phpbb\install\helper\iohandler\iohandler_interface;
  21  use phpbb\install\task_base;
  22  
  23  class download_updated_files extends task_base
  24  {
  25      /**
  26       * @var config
  27       */
  28      protected $installer_config;
  29  
  30      /**
  31       * @var filesystem
  32       */
  33      protected $filesystem;
  34  
  35      /**
  36       * @var iohandler_interface
  37       */
  38      protected $iohandler;
  39  
  40      /**
  41       * Constructor
  42       *
  43       * @param config                $config
  44       * @param iohandler_interface    $iohandler
  45       * @param filesystem            $filesystem
  46       */
  47  	public function __construct(config $config, iohandler_interface $iohandler, filesystem $filesystem)
  48      {
  49          $this->installer_config    = $config;
  50          $this->iohandler        = $iohandler;
  51          $this->filesystem        = $filesystem;
  52  
  53          parent::__construct(false);
  54      }
  55  
  56      /**
  57       * {@inheritdoc}
  58       */
  59  	public function check_requirements()
  60      {
  61          return $this->installer_config->get('do_update_files', false)
  62              && $this->installer_config->get('file_update_method', '') === 'compression';
  63      }
  64  
  65      /**
  66       * {@inheritdoc}
  67       */
  68  	public function run()
  69      {
  70          if ($this->iohandler->get_input('database_update_submit', false))
  71          {
  72              // Remove archive
  73              $this->filesystem->remove(
  74                  $this->installer_config->get('update_file_archive', null)
  75              );
  76  
  77              $this->installer_config->set('update_file_archive', null);
  78          }
  79          else if ($this->iohandler->get_input('update_recheck_files_submit', false))
  80          {
  81              $this->installer_config->set('file_updater_elem_progress', '');
  82              $this->installer_config->set('update_files', array());
  83              throw new jump_to_restart_point_exception('check_update_files');
  84          }
  85          else
  86          {
  87              $file_update_info = $this->installer_config->get('update_files', array());
  88  
  89              // Display download box only if the archive won't be empty
  90              if (!empty($file_update_info) && !(isset($file_update_info['delete']) && count($file_update_info) == 1))
  91              {
  92                  // Render download box
  93                  $this->iohandler->add_download_link(
  94                      'phpbb_installer_update_file_download',
  95                      'DOWNLOAD_UPDATE_METHOD',
  96                      'DOWNLOAD_UPDATE_METHOD_EXPLAIN'
  97                  );
  98              }
  99  
 100              // Add form to continue update
 101              $this->iohandler->add_user_form_group('UPDATE_CONTINUE_UPDATE_PROCESS', array(
 102                  'update_recheck_files_submit'    => array(
 103                      'label'            => 'UPDATE_RECHECK_UPDATE_FILES',
 104                      'type'            => 'submit',
 105                      'is_secondary'    => empty($file_update_info),
 106                  ),
 107                  'database_update_submit'    => array(
 108                      'label'        => 'UPDATE_CONTINUE_UPDATE_PROCESS',
 109                      'type'        => 'submit',
 110                      'disabled'    => !empty($file_update_info),
 111                  ),
 112              ));
 113  
 114              throw new user_interaction_required_exception();
 115          }
 116      }
 117  
 118      /**
 119       * {@inheritdoc}
 120       */
 121  	static public function get_step_count()
 122      {
 123          return 0;
 124      }
 125  
 126      /**
 127       * {@inheritdoc}
 128       */
 129  	public function get_task_lang_name()
 130      {
 131          return '';
 132      }
 133  }


Generated: Tue Apr 7 19:42:26 2020 Cross-referenced by PHPXref 0.7.1