1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 16:27:38 +02:00

[ticket/15253] Use storage helper methods instead of filesystem methods

PHPBB3-15253
This commit is contained in:
Rubén Calvo
2017-06-26 15:49:31 +02:00
parent 21c9b0eeae
commit ecb79539f4
62 changed files with 109 additions and 598 deletions

View File

@@ -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);
}
/**