diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-13 09:52:02 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-13 09:52:02 -0500 |
commit | aa710df2db2512f6065f91dcf8b5fc7d100edf41 (patch) | |
tree | 89ae712128b68db41237e032315dcbf17dea1108 /phpBB/phpbb/filesystem.php | |
parent | a194e6ce7afe373fcb89ab26b3d057f60d10fa3d (diff) | |
download | forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.tar forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.tar.gz forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.tar.bz2 forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.tar.xz forums-aa710df2db2512f6065f91dcf8b5fc7d100edf41.zip |
[ticket/11832] Create phpbb_symfony_request to handle initiating symfony_request
Now symfony_request is also a service (removed the function
phpbb_create_symfony_request).
Inject symfony request into filesystem
Cleanup for the tests
PHPBB3-11832
Diffstat (limited to 'phpBB/phpbb/filesystem.php')
-rw-r--r-- | phpBB/phpbb/filesystem.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 5d70b88a29..e6c36375af 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -7,8 +7,6 @@ * */ -use Symfony\Component\HttpFoundation\Request; - /** * @ignore */ @@ -23,6 +21,9 @@ if (!defined('IN_PHPBB')) */ class phpbb_filesystem { + /** @var phpbb_symfony_request */ + protected $symfony_request; + /** @var string */ protected $phpbb_root_path; @@ -32,10 +33,12 @@ class phpbb_filesystem /** * Constructor * + * @param phpbb_symfony_request $symfony_request * @param string $phpbb_root_path */ - public function __construct($phpbb_root_path) + public function __construct(phpbb_symfony_request $symfony_request, $phpbb_root_path) { + $this->symfony_request = $symfony_request; $this->phpbb_root_path = $phpbb_root_path; } @@ -57,12 +60,12 @@ class phpbb_filesystem * is not at the beginning of $path, just prepends the * web root path * - * @param Request $symfony_request Symfony Request object + * @param string $path The path to be updated * @return string */ - public function update_web_root_path($path, Request $symfony_request = null) + public function update_web_root_path($path) { - $web_root_path = $this->get_web_root_path($symfony_request); + $web_root_path = $this->get_web_root_path($this->symfony_request); if (strpos($path, $this->phpbb_root_path) === 0) { @@ -75,12 +78,11 @@ class phpbb_filesystem /** * Get a relative root path from the current URL * - * @param Request $symfony_request Symfony Request object * @return string */ - public function get_web_root_path(Request $symfony_request = null) + public function get_web_root_path() { - if ($symfony_request === null) + if ($this->symfony_request === null) { return $this->phpbb_root_path; } @@ -91,13 +93,13 @@ class phpbb_filesystem } // Path info (e.g. /foo/bar) - $path_info = $this->clean_path($symfony_request->getPathInfo()); + $path_info = $this->clean_path($this->symfony_request->getPathInfo()); // Full request URI (e.g. phpBB/app.php/foo/bar) - $request_uri = $symfony_request->getRequestUri(); + $request_uri = $this->symfony_request->getRequestUri(); // Script name URI (e.g. phpBB/app.php) - $script_name = $symfony_request->getScriptName(); + $script_name = $this->symfony_request->getScriptName(); /* * If the path info is empty (single /), then we're not using |