1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

[ticket/13358] Add file_downloader to version_helper

PHPBB3-13358
This commit is contained in:
Marc Alexander 2014-11-21 18:07:36 +01:00
parent a080173010
commit 2793f9c078
2 changed files with 10 additions and 2 deletions

View File

@ -186,4 +186,5 @@ services:
arguments:
- @cache
- @config
- @file_downloader
- @user

View File

@ -50,6 +50,9 @@ class version_helper
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\file_downloader */
protected $file_downloader;
/** @var \phpbb\user */
protected $user;
@ -58,12 +61,14 @@ class version_helper
*
* @param \phpbb\cache\service $cache
* @param \phpbb\config\config $config
* @param \phpbb\file_downloader $file_downloader
* @param \phpbb\user $user
*/
public function __construct(\phpbb\cache\service $cache, \phpbb\config\config $config, \phpbb\user $user)
public function __construct(\phpbb\cache\service $cache, \phpbb\config\config $config, file_downloader $file_downloader, \phpbb\user $user)
{
$this->cache = $cache;
$this->config = $config;
$this->file_downloader = $file_downloader;
$this->user = $user;
if (defined('PHPBB_QA'))
@ -250,7 +255,9 @@ class version_helper
else if ($info === false || $force_update)
{
$errstr = $errno = '';
$info = get_remote_file($this->host, $this->path, $this->file, $errstr, $errno);
$this->file_downloader->set_error_number($errno)
->set_error_string($errstr);
$info = $this->file_downloader->get($this->host, $this->path, $this->file);
if (!empty($errstr))
{