示例#1
0
 /**
  * Constructor
  *
  * @param container_factory		$container
  * @param config				$config
  * @param iohandler_interface	$iohandler
  * @param filesystem			$filesystem
  * @param factory				$file_updater_factory
  */
 public function __construct(container_factory $container, config $config, iohandler_interface $iohandler, filesystem $filesystem, factory $file_updater_factory)
 {
     $this->installer_config = $config;
     $this->iohandler = $iohandler;
     $this->filesystem = $filesystem;
     $this->cache = $container->get('cache.driver');
     // Initialize compression file updater
     $this->file_updater = $file_updater_factory->get('compression');
     parent::__construct(false);
 }
示例#2
0
 /**
  * Get file updater
  *
  * @param null|string	$file_updater_method	Name of the file updater to use
  *
  * @return file_updater_interface	File updater
  */
 protected function get_file_updater($file_updater_method = null)
 {
     $file_updater_method = $file_updater_method === null ? $this->installer_config->get('file_update_method', '') : $file_updater_method;
     if ($file_updater_method === 'compression') {
         $compression_method = $this->installer_config->get('file_update_compression', '');
         /** @var \phpbb\install\helper\file_updater\compression_file_updater $file_updater */
         $file_updater = $this->factory->get('compression');
         $archive_path = $file_updater->init($compression_method);
         $this->installer_config->set('update_file_archive', $archive_path);
     } else {
         if ($file_updater_method === 'ftp') {
             /** @var \phpbb\install\helper\file_updater\ftp_file_updater $file_updater */
             $file_updater = $this->factory->get('ftp');
             $file_updater->init($this->installer_config->get('ftp_method', ''), $this->installer_config->get('ftp_host', ''), $this->installer_config->get('ftp_user', ''), $this->installer_config->get('ftp_pass', ''), $this->installer_config->get('ftp_path', ''), $this->installer_config->get('ftp_port', 0), $this->installer_config->get('ftp_timeout', 10));
         } else {
             /** @var file_updater_interface $file_updater */
             $file_updater = $this->factory->get('direct_file');
         }
     }
     return $file_updater;
 }