mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-28 10:40:28 +02:00
[ticket/15311] Use cache directory if can't use system temp
PHPBB3-15311
This commit is contained in:
@@ -17,6 +17,7 @@ use bantu\IniGetWrapper\IniGetWrapper;
|
||||
use phpbb\config\config;
|
||||
use phpbb\files\factory;
|
||||
use phpbb\files\filespec;
|
||||
use phpbb\filesystem\filesystem;
|
||||
use phpbb\language\language;
|
||||
use phpbb\request\request_interface;
|
||||
|
||||
@@ -28,6 +29,15 @@ class remote extends base
|
||||
/** @var factory Files factory */
|
||||
protected $factory;
|
||||
|
||||
/** @var filesystem Filesystem */
|
||||
protected $filesystem;
|
||||
|
||||
/** @var language */
|
||||
protected $language;
|
||||
|
||||
/** @var IniGetWrapper */
|
||||
protected $php_ini;
|
||||
|
||||
/** @var request_interface */
|
||||
protected $request;
|
||||
|
||||
@@ -39,15 +49,17 @@ class remote extends base
|
||||
*
|
||||
* @param config $config phpBB config
|
||||
* @param factory $factory Files factory
|
||||
* @param filesystem $filesystem Filesystem
|
||||
* @param language $language Language class
|
||||
* @param IniGetWrapper $php_ini ini_get() wrapper
|
||||
* @param request_interface $request Request object
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
*/
|
||||
public function __construct(config $config, factory $factory, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
|
||||
public function __construct(config $config, factory $factory, filesystem $filesystem, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->factory = $factory;
|
||||
$this->filesystem = $filesystem;
|
||||
$this->language = $language;
|
||||
$this->php_ini = $php_ini;
|
||||
$this->request = $request;
|
||||
@@ -139,7 +151,7 @@ class remote extends base
|
||||
|
||||
$data = $response->getBody();
|
||||
|
||||
$filename = tempnam(sys_get_temp_dir(), unique_id() . '-');
|
||||
$filename = tempnam($this->filesystem->get_temp_dir(), unique_id() . '-');
|
||||
|
||||
if (!($fp = @fopen($filename, 'wb')))
|
||||
{
|
||||
|
@@ -17,6 +17,7 @@ use bantu\IniGetWrapper\IniGetWrapper;
|
||||
use phpbb\config\config;
|
||||
use phpbb\files\factory;
|
||||
use phpbb\files\filespec;
|
||||
use phpbb\filesystem\filesystem;
|
||||
use phpbb\language\language;
|
||||
use phpbb\request\request_interface;
|
||||
|
||||
@@ -28,6 +29,15 @@ class remote_storage extends base
|
||||
/** @var factory Files factory */
|
||||
protected $factory;
|
||||
|
||||
/** @var filesystem Filesystem */
|
||||
protected $filesystem;
|
||||
|
||||
/** @var language */
|
||||
protected $language;
|
||||
|
||||
/** @var IniGetWrapper */
|
||||
protected $php_ini;
|
||||
|
||||
/** @var request_interface */
|
||||
protected $request;
|
||||
|
||||
@@ -39,15 +49,17 @@ class remote_storage extends base
|
||||
*
|
||||
* @param config $config phpBB config
|
||||
* @param factory $factory Files factory
|
||||
* @param filesystem $filesystem Filesystem
|
||||
* @param language $language Language class
|
||||
* @param IniGetWrapper $php_ini ini_get() wrapper
|
||||
* @param request_interface $request Request object
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
*/
|
||||
public function __construct(config $config, factory $factory, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
|
||||
public function __construct(config $config, factory $factory, filesystem $filesystem, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->factory = $factory;
|
||||
$this->filesystem = $filesystem;
|
||||
$this->language = $language;
|
||||
$this->php_ini = $php_ini;
|
||||
$this->request = $request;
|
||||
@@ -138,7 +150,7 @@ class remote_storage extends base
|
||||
|
||||
$data = $response->getBody();
|
||||
|
||||
$filename = tempnam(sys_get_temp_dir(), unique_id() . '-');
|
||||
$filename = tempnam($this->filesystem->get_temp_dir(), unique_id() . '-');
|
||||
|
||||
if (!($fp = @fopen($filename, 'wb')))
|
||||
{
|
||||
|
Reference in New Issue
Block a user