mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-07 17:27:16 +02:00
[ticket/15253] Use storage helper methods instead of filesystem methods
PHPBB3-15253
This commit is contained in:
@@ -156,9 +156,7 @@ class bbcode
|
||||
$phpbb_container->get('path_helper'),
|
||||
$phpbb_container->getParameter('core.cache_dir'),
|
||||
$phpbb_container->get('ext.manager'),
|
||||
new \phpbb\template\twig\loader(
|
||||
$phpbb_filesystem
|
||||
)
|
||||
new \phpbb\template\twig\loader()
|
||||
),
|
||||
$phpbb_container->getParameter('core.cache_dir'),
|
||||
$phpbb_container->get('user'),
|
||||
|
@@ -3479,15 +3479,7 @@ function phpbb_filter_root_path($errfile)
|
||||
|
||||
if (empty($root_path))
|
||||
{
|
||||
if ($phpbb_filesystem)
|
||||
{
|
||||
$root_path = $phpbb_filesystem->realpath(dirname(__FILE__) . '/../');
|
||||
}
|
||||
else
|
||||
{
|
||||
$filesystem = new \phpbb\filesystem\filesystem();
|
||||
$root_path = $filesystem->realpath(dirname(__FILE__) . '/../');
|
||||
}
|
||||
$root_path = \phpbb\storage\helper::realpath(dirname(__FILE__) . '/../');
|
||||
}
|
||||
|
||||
return str_replace(array($root_path, '\\'), array('[ROOT]', '/'), $errfile);
|
||||
|
@@ -87,7 +87,7 @@ function phpbb_check_hash($password, $hash)
|
||||
/**
|
||||
* Eliminates useless . and .. components from specified path.
|
||||
*
|
||||
* Deprecated, use filesystem class instead
|
||||
* Deprecated, use storage helper class instead
|
||||
*
|
||||
* @param string $path Path to clean
|
||||
* @return string Cleaned path
|
||||
@@ -96,36 +96,12 @@ function phpbb_check_hash($password, $hash)
|
||||
*/
|
||||
function phpbb_clean_path($path)
|
||||
{
|
||||
global $phpbb_path_helper, $phpbb_container;
|
||||
|
||||
if (!$phpbb_path_helper && $phpbb_container)
|
||||
if (!class_exists('\phpbb\storage\helper'))
|
||||
{
|
||||
/* @var $phpbb_path_helper \phpbb\path_helper */
|
||||
$phpbb_path_helper = $phpbb_container->get('path_helper');
|
||||
}
|
||||
else if (!$phpbb_path_helper)
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
// The container is not yet loaded, use a new instance
|
||||
if (!class_exists('\phpbb\path_helper'))
|
||||
{
|
||||
require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx);
|
||||
}
|
||||
|
||||
$request = new phpbb\request\request();
|
||||
$phpbb_path_helper = new phpbb\path_helper(
|
||||
new phpbb\symfony_request(
|
||||
$request
|
||||
),
|
||||
new phpbb\filesystem\filesystem(),
|
||||
$request,
|
||||
$phpbb_root_path,
|
||||
$phpEx
|
||||
);
|
||||
require($phpbb_root_path . 'phpbb/storage/helper.' . $phpEx);
|
||||
}
|
||||
|
||||
return $phpbb_path_helper->clean_path($path);
|
||||
return \phpbb\storage\helper::clean_path($path);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,25 +439,31 @@ function phpbb_is_writable($file)
|
||||
* @param string $path Path to check absoluteness of
|
||||
* @return boolean
|
||||
*
|
||||
* @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::is_absolute_path() instead
|
||||
* @deprecated 3.2.0-dev use \phpbb\storage\helper::is_absolute_path() instead
|
||||
*/
|
||||
function phpbb_is_absolute($path)
|
||||
{
|
||||
global $phpbb_filesystem;
|
||||
if (!class_exists('\phpbb\storage\helper'))
|
||||
{
|
||||
require($phpbb_root_path . 'phpbb/storage/helper.' . $phpEx);
|
||||
}
|
||||
|
||||
return $phpbb_filesystem->is_absolute_path($path);
|
||||
return \phpbb\storage\helper::is_absolute_path($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* A wrapper for realpath
|
||||
*
|
||||
* @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::realpath() instead
|
||||
* @deprecated 3.2.0-dev use \phpbb\storage\helper::realpath() instead
|
||||
*/
|
||||
function phpbb_realpath($path)
|
||||
{
|
||||
global $phpbb_filesystem;
|
||||
if (!class_exists('\phpbb\storage\helper'))
|
||||
{
|
||||
require($phpbb_root_path . 'phpbb/storage/helper.' . $phpEx);
|
||||
}
|
||||
|
||||
return $phpbb_filesystem->realpath($path);
|
||||
return \phpbb\storage\helper::realpath($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -699,9 +699,7 @@ class messenger
|
||||
$phpbb_container->get('path_helper'),
|
||||
$phpbb_container->getParameter('core.template.cache_path'),
|
||||
$phpbb_container->get('ext.manager'),
|
||||
new \phpbb\template\twig\loader(
|
||||
$phpbb_container->get('filesystem')
|
||||
),
|
||||
new \phpbb\template\twig\loader(),
|
||||
$phpbb_dispatcher,
|
||||
array()
|
||||
);
|
||||
|
Reference in New Issue
Block a user