[ Index ]

PHP Cross Reference of phpBB-3.2.8-deutsch

title

Body

[close]

/phpbb/install/module/obtain_data/task/ -> obtain_update_settings.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\obtain_data\task;
  15  
  16  use phpbb\install\exception\user_interaction_required_exception;
  17  use phpbb\install\helper\config;
  18  use phpbb\install\helper\iohandler\iohandler_interface;
  19  use phpbb\install\task_base;
  20  
  21  class obtain_update_settings extends task_base
  22  {
  23      /**
  24       * @var \phpbb\install\helper\config
  25       */
  26      protected $installer_config;
  27  
  28      /**
  29       * @var \phpbb\install\helper\iohandler\iohandler_interface
  30       */
  31      protected $iohandler;
  32  
  33      /**
  34       * Constructor
  35       *
  36       * @param config                $installer_config
  37       * @param iohandler_interface    $iohandler
  38       */
  39  	public function __construct(config $installer_config, iohandler_interface $iohandler)
  40      {
  41          $this->installer_config    = $installer_config;
  42          $this->iohandler        = $iohandler;
  43  
  44          parent::__construct(true);
  45      }
  46  
  47      /**
  48       * {@inheritdoc}
  49       */
  50  	public function run()
  51      {
  52          // Check if data is sent
  53          if ($this->iohandler->get_input('submit_update', false))
  54          {
  55              $update_files = $this->iohandler->get_input('update_type', 'all') === 'all';
  56  
  57              if ($this->installer_config->get('disable_filesystem_update', false) && $update_files)
  58              {
  59                  $this->iohandler->add_error_message('UPDATE_FILES_NOT_FOUND');
  60  
  61                  throw new user_interaction_required_exception();
  62              }
  63  
  64              $this->installer_config->set('do_update_files', $update_files);
  65          }
  66          else
  67          {
  68              if ($this->installer_config->get('disable_filesystem_update', false))
  69              {
  70                  $options[] = array(
  71                      'value'        => 'db_only',
  72                      'label'        => 'UPDATE_TYPE_DB_ONLY',
  73                      'selected'    => true,
  74                  );
  75              }
  76              else
  77              {
  78                  $options = array(
  79                      array(
  80                          'value'        => 'all',
  81                          'label'        => 'UPDATE_TYPE_ALL',
  82                          'selected'    => true,
  83                      ),
  84                      array(
  85                          'value'        => 'db_only',
  86                          'label'        => 'UPDATE_TYPE_DB_ONLY',
  87                          'selected'    => false,
  88                      ),
  89                  );
  90              }
  91  
  92              $this->iohandler->add_user_form_group('UPDATE_TYPE', array(
  93                  'update_type' => array(
  94                      'label'        => 'UPDATE_TYPE',
  95                      'type'        => 'radio',
  96                      'options'    => $options,
  97                  ),
  98                  'submit_update' => array(
  99                      'label'    => 'SUBMIT',
 100                      'type'    => 'submit',
 101                  ),
 102              ));
 103  
 104              throw new user_interaction_required_exception();
 105          }
 106      }
 107  
 108      /**
 109       * {@inheritdoc}
 110       */
 111  	static public function get_step_count()
 112      {
 113          return 0;
 114      }
 115  
 116      /**
 117       * {@inheritdoc}
 118       */
 119  	public function get_task_lang_name()
 120      {
 121          return '';
 122      }
 123  }


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