aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-09-13 10:04:35 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2013-09-13 10:04:35 -0500
commit21624e79fc512fd86177080010bb7d26c71ce3cb (patch)
treeac453dbf1b818f8383029146d5f8ca9a7920ad3e
parentf8e665751a0926807c8352eb2b2d942247d3c029 (diff)
downloadforums-21624e79fc512fd86177080010bb7d26c71ce3cb.tar
forums-21624e79fc512fd86177080010bb7d26c71ce3cb.tar.gz
forums-21624e79fc512fd86177080010bb7d26c71ce3cb.tar.bz2
forums-21624e79fc512fd86177080010bb7d26c71ce3cb.tar.xz
forums-21624e79fc512fd86177080010bb7d26c71ce3cb.zip
[ticket/11832] Fix constructions of phpbb_filesystem
PHPBB3-11832
-rw-r--r--phpBB/common.php7
-rw-r--r--phpBB/includes/functions.php9
-rw-r--r--tests/dbal/migrator_test.php7
-rw-r--r--tests/extension/manager_test.php7
-rw-r--r--tests/extension/metadata_manager_test.php7
-rw-r--r--tests/log/function_view_log_test.php4
-rw-r--r--tests/mock/extension_manager.php7
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php7
8 files changed, 41 insertions, 14 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index 43beb86972..fc309892d6 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -47,7 +47,12 @@ if (!defined('PHPBB_INSTALLED'))
// Eliminate . and .. from the path
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
- $phpbb_filesystem = new phpbb_filesystem($phpbb_root_path);
+ $phpbb_filesystem = new phpbb_filesystem(
+ new phpbb_symfony_request(
+ new phpbb_request()
+ ),
+ $phpbb_root_path
+ );
$script_path = $phpbb_filesystem->clean_path($script_path);
$url = (($secure) ? 'https://' : 'http://') . $server_name;
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index ab4df9be54..cf9f71244b 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2411,7 +2411,6 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
{
global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_filesystem;
global $phpbb_dispatcher;
- global $symfony_request, $phpbb_root_path, $phpbb_container;
if ($params === '' || (is_array($params) && empty($params)))
{
@@ -2422,7 +2421,7 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
// Update the root path with the correct relative web path
if ($phpbb_filesystem instanceof phpbb_filesystem)
{
- $url = $phpbb_filesystem->update_web_root_path($url, $symfony_request);
+ $url = $phpbb_filesystem->update_web_root_path($url);
}
$append_sid_overwrite = false;
@@ -2820,7 +2819,7 @@ function build_url($strip_vars = false)
// On some situations, the redirect path is an absolute URL, sometimes a relative path
// For a relative path, let's prefix it with $phpbb_root_path to point to the correct location,
// else we use the URL directly.
- $url_parts = @parse_url($page);
+ $url_parts = parse_url($page);
// URL
if ($url_parts !== false && !empty($url_parts['scheme']) && !empty($url_parts['host']))
@@ -5081,7 +5080,7 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
{
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
- global $phpbb_dispatcher, $request, $phpbb_container, $symfony_request, $adm_relative_path;
+ global $phpbb_dispatcher, $request, $phpbb_container, $adm_relative_path;
if (defined('HEADER_INC'))
{
@@ -5242,7 +5241,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
// call below. We need to correct it in case we are accessing from a
// controller because the web paths will be incorrect otherwise.
$phpbb_filesystem = $phpbb_container->get('filesystem');
- $corrected_path = $phpbb_filesystem->get_web_root_path($symfony_request);
+ $corrected_path = $phpbb_filesystem->get_web_root_path();
$web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path;
// Send a proper content-language to the output
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index 4be1fbe176..5f0818d568 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -59,7 +59,12 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$container,
$this->db,
$this->config,
- new phpbb_filesystem(dirname(__FILE__) . '/../../phpBB/'),
+ new phpbb_filesystem(
+ new phpbb_symfony_request(
+ new phpbb_mock_request()
+ ),
+ dirname(__FILE__) . '/../../phpBB/'
+ ),
'phpbb_ext',
dirname(__FILE__) . '/../../phpBB/',
'php',
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index 2da6ba5df5..b9a920d092 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -114,7 +114,12 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$container,
$db,
$config,
- new phpbb_filesystem($phpbb_root_path),
+ new phpbb_filesystem(
+ new phpbb_symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path
+ ),
'phpbb_ext',
dirname(__FILE__) . '/',
$php_ext,
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index 594568b805..6b27929ebf 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -65,7 +65,12 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$container,
$this->db,
$this->config,
- new phpbb_filesystem($this->phpbb_root_path),
+ new phpbb_filesystem(
+ new phpbb_symfony_request(
+ new phpbb_mock_request()
+ ),
+ $this->phpbb_root_path
+ ),
'phpbb_ext',
$this->phpbb_root_path,
$this->phpEx,
diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php
index a634863fb6..6827aaa1b6 100644
--- a/tests/log/function_view_log_test.php
+++ b/tests/log/function_view_log_test.php
@@ -23,10 +23,8 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
public static function view_log_function_data()
{
- global $phpEx, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path;
+ global $phpEx, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $phpbb_container = new phpbb_mock_container_builder();
- $phpbb_container->set('filesystem', new phpbb_filesystem($phpbb_root_path));
$expected_data_sets = array(
1 => array(
diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php
index 28eec5930f..0c73adcf47 100644
--- a/tests/mock/extension_manager.php
+++ b/tests/mock/extension_manager.php
@@ -14,6 +14,11 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = 'php';
$this->extensions = $extensions;
- $this->filesystem = new phpbb_filesystem($phpbb_root_path);
+ $this->filesystem = new phpbb_filesystem(
+ new phpbb_symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path
+ );
}
}
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 579e225ed9..48c5649281 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -203,7 +203,12 @@ class phpbb_functional_test_case extends phpbb_test_case
$container,
$db,
$config,
- new phpbb_filesystem($phpbb_root_path),
+ new phpbb_filesystem(
+ new phpbb_symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path
+ ),
self::$config['table_prefix'] . 'ext',
dirname(__FILE__) . '/',
$php_ext,