mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 06:38:52 +00:00
[ticket/13358] Add file_downloader to version_helper
PHPBB3-13358
This commit is contained in:
parent
a080173010
commit
2793f9c078
2 changed files with 10 additions and 2 deletions
|
@ -186,4 +186,5 @@ services:
|
||||||
arguments:
|
arguments:
|
||||||
- @cache
|
- @cache
|
||||||
- @config
|
- @config
|
||||||
|
- @file_downloader
|
||||||
- @user
|
- @user
|
||||||
|
|
|
@ -50,6 +50,9 @@ class version_helper
|
||||||
/** @var \phpbb\config\config */
|
/** @var \phpbb\config\config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
|
/** @var \phpbb\file_downloader */
|
||||||
|
protected $file_downloader;
|
||||||
|
|
||||||
/** @var \phpbb\user */
|
/** @var \phpbb\user */
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
@ -58,12 +61,14 @@ class version_helper
|
||||||
*
|
*
|
||||||
* @param \phpbb\cache\service $cache
|
* @param \phpbb\cache\service $cache
|
||||||
* @param \phpbb\config\config $config
|
* @param \phpbb\config\config $config
|
||||||
|
* @param \phpbb\file_downloader $file_downloader
|
||||||
* @param \phpbb\user $user
|
* @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->cache = $cache;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
$this->file_downloader = $file_downloader;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
if (defined('PHPBB_QA'))
|
if (defined('PHPBB_QA'))
|
||||||
|
@ -250,7 +255,9 @@ class version_helper
|
||||||
else if ($info === false || $force_update)
|
else if ($info === false || $force_update)
|
||||||
{
|
{
|
||||||
$errstr = $errno = '';
|
$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))
|
if (!empty($errstr))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue