aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Calvo <rubencm@gmail.com>2018-05-30 23:15:31 +0200
committerRubén Calvo <rubencm@gmail.com>2018-05-30 23:56:56 +0200
commitb43268e8fcadc336df74c4b803484f295e6f3f12 (patch)
tree44e8e029ff6d316b06c5f606deee2863dc2ef32b /phpBB/phpbb/files
parent[ticket/15311] Fix code style (diff)
downloadphpbb-b43268e8fcadc336df74c4b803484f295e6f3f12.tar.gz
phpbb-b43268e8fcadc336df74c4b803484f295e6f3f12.tar.bz2
phpbb-b43268e8fcadc336df74c4b803484f295e6f3f12.zip
[ticket/15311] Move get_temp_dir to another service
PHPBB3-15311
Diffstat (limited to 'phpBB/phpbb/files')
-rw-r--r--phpBB/phpbb/files/types/remote.php19
-rw-r--r--phpBB/phpbb/files/types/remote_storage.php19
2 files changed, 14 insertions, 24 deletions
diff --git a/phpBB/phpbb/files/types/remote.php b/phpBB/phpbb/files/types/remote.php
index b32b06adce..3bfd7dc7cd 100644
--- a/phpBB/phpbb/files/types/remote.php
+++ b/phpBB/phpbb/files/types/remote.php
@@ -17,7 +17,7 @@ use bantu\IniGetWrapper\IniGetWrapper;
use phpbb\config\config;
use phpbb\files\factory;
use phpbb\files\filespec;
-use phpbb\filesystem\filesystem;
+use phpbb\filesystem\temp;
use phpbb\language\language;
use phpbb\request\request_interface;
@@ -29,8 +29,8 @@ class remote extends base
/** @var factory Files factory */
protected $factory;
- /** @var filesystem Filesystem */
- protected $filesystem;
+ /** @var filesystem Filesystem temp */
+ protected $temp;
/** @var language */
protected $language;
@@ -41,29 +41,24 @@ class remote extends base
/** @var request_interface */
protected $request;
- /** @var string phpBB root path */
- protected $phpbb_root_path;
-
/**
* Construct a form upload type
*
* @param config $config phpBB config
* @param factory $factory Files factory
- * @param filesystem $filesystem Filesystem
+ * @param temp $temp Filesystem temp
* @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, filesystem $filesystem, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
+ public function __construct(config $config, factory $factory, temp $temp, language $language, IniGetWrapper $php_ini, request_interface $request)
{
$this->config = $config;
$this->factory = $factory;
- $this->filesystem = $filesystem;
+ $this->temp = $temp;
$this->language = $language;
$this->php_ini = $php_ini;
$this->request = $request;
- $this->phpbb_root_path = $phpbb_root_path;
}
/**
@@ -151,7 +146,7 @@ class remote extends base
$data = $response->getBody();
- $filename = tempnam($this->filesystem->get_temp_dir(), unique_id() . '-');
+ $filename = tempnam($this->temp->get_temp_dir(), unique_id() . '-');
if (!($fp = @fopen($filename, 'wb')))
{
diff --git a/phpBB/phpbb/files/types/remote_storage.php b/phpBB/phpbb/files/types/remote_storage.php
index 54960b477e..8c2ceb6900 100644
--- a/phpBB/phpbb/files/types/remote_storage.php
+++ b/phpBB/phpbb/files/types/remote_storage.php
@@ -17,7 +17,7 @@ use bantu\IniGetWrapper\IniGetWrapper;
use phpbb\config\config;
use phpbb\files\factory;
use phpbb\files\filespec;
-use phpbb\filesystem\filesystem;
+use phpbb\filesystem\temp;
use phpbb\language\language;
use phpbb\request\request_interface;
@@ -29,8 +29,8 @@ class remote_storage extends base
/** @var factory Files factory */
protected $factory;
- /** @var filesystem Filesystem */
- protected $filesystem;
+ /** @var temp Filesystem temp */
+ protected $temp;
/** @var language */
protected $language;
@@ -41,29 +41,24 @@ class remote_storage extends base
/** @var request_interface */
protected $request;
- /** @var string phpBB root path */
- protected $phpbb_root_path;
-
/**
* Construct a form upload type
*
* @param config $config phpBB config
* @param factory $factory Files factory
- * @param filesystem $filesystem Filesystem
+ * @param temp $temp Filesystem temp
* @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, filesystem $filesystem, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
+ public function __construct(config $config, factory $factory, temp $temp, language $language, IniGetWrapper $php_ini, request_interface $request)
{
$this->config = $config;
$this->factory = $factory;
- $this->filesystem = $filesystem;
+ $this->temp = $temp;
$this->language = $language;
$this->php_ini = $php_ini;
$this->request = $request;
- $this->phpbb_root_path = $phpbb_root_path;
}
/**
@@ -150,7 +145,7 @@ class remote_storage extends base
$data = $response->getBody();
- $filename = tempnam($this->filesystem->get_temp_dir(), unique_id() . '-');
+ $filename = tempnam($this->temp->get_temp_dir(), unique_id() . '-');
if (!($fp = @fopen($filename, 'wb')))
{