1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-14 04:42:04 +02:00

[ticket/15253] Make symfony_filesystem variable static

PHPBB3-15253
This commit is contained in:
Rubén Calvo 2017-06-27 17:06:54 +02:00
parent 425fb5b09d
commit 9de384fb22

@ -17,6 +17,12 @@ use Symfony\Component\Filesystem\Filesystem as symfony_filesystem;
class helper
{
/**
* @var \Symfony\Component\Filesystem\Filesystem
*/
protected static $symfony_filesystem;
/**
* Eliminates useless . and .. components from specified path.
*
@ -207,8 +213,7 @@ class helper
*/
public static function make_path_relative($end_path, $start_path)
{
$symfony_filesystem = new symfony_filesystem();
return $symfony_filesystem->makePathRelative($end_path, $start_path);
self::get_symfony_filesystem()->makePathRelative($end_path, $start_path);
}
/**
@ -363,4 +368,19 @@ class helper
return ($return_array) ? $resolved : $resolved_path;
}
/**
* Get an instance of symfony's filesystem object.
*
* @return \Symfony\Component\Filesystem\Filesystem Symfony filesystem
*/
protected static function get_symfony_filesystem()
{
if (self::$symfony_filesystem === null)
{
self::$symfony_filesystem = new symfony_filesystem();
}
return self::$symfony_filesystem;
}
}