mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15253] Make symfony_filesystem variable static
PHPBB3-15253
This commit is contained in:
parent
425fb5b09d
commit
9de384fb22
1 changed files with 22 additions and 2 deletions
|
@ -17,6 +17,12 @@ use Symfony\Component\Filesystem\Filesystem as symfony_filesystem;
|
||||||
|
|
||||||
class helper
|
class helper
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Symfony\Component\Filesystem\Filesystem
|
||||||
|
*/
|
||||||
|
protected static $symfony_filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Eliminates useless . and .. components from specified path.
|
* Eliminates useless . and .. components from specified path.
|
||||||
*
|
*
|
||||||
|
@ -207,8 +213,7 @@ class helper
|
||||||
*/
|
*/
|
||||||
public static function make_path_relative($end_path, $start_path)
|
public static function make_path_relative($end_path, $start_path)
|
||||||
{
|
{
|
||||||
$symfony_filesystem = new symfony_filesystem();
|
self::get_symfony_filesystem()->makePathRelative($end_path, $start_path);
|
||||||
return $symfony_filesystem->makePathRelative($end_path, $start_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -363,4 +368,19 @@ class helper
|
||||||
|
|
||||||
return ($return_array) ? $resolved : $resolved_path;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue