[ticket/11362] Use new filesystem class in finder

PHPBB3-11362
This commit is contained in:
Joas Schilling 2013-04-17 17:50:44 +02:00
parent 869e00a23b
commit 158bce0209

View file

@ -23,6 +23,7 @@ if (!defined('IN_PHPBB'))
class phpbb_extension_finder
{
protected $extension_manager;
protected $filesystem;
protected $phpbb_root_path;
protected $cache;
protected $php_ext;
@ -54,15 +55,17 @@ class phpbb_extension_finder
* @param phpbb_extension_manager $extension_manager An extension manager
* instance that provides the finder with a list of active
* extensions and their locations
* @param phpbb_filesystem $filesystem Filesystem instance
* @param string $phpbb_root_path Path to the phpbb root directory
* @param phpbb_cache_driver_interface $cache A cache instance or null
* @param string $php_ext php file extension
* @param string $cache_name The name of the cache variable, defaults to
* _ext_finder
*/
public function __construct(phpbb_extension_manager $extension_manager, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $php_ext = '.php', $cache_name = '_ext_finder')
public function __construct(phpbb_extension_manager $extension_manager, phpbb_filesystem $filesystem, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $php_ext = '.php', $cache_name = '_ext_finder')
{
$this->extension_manager = $extension_manager;
$this->filesystem = $filesystem;
$this->phpbb_root_path = $phpbb_root_path;
$this->cache = $cache;
$this->php_ext = $php_ext;
@ -227,7 +230,7 @@ class phpbb_extension_finder
*/
protected function sanitise_directory($directory)
{
$directory = phpbb_clean_path($directory);
$directory = $this->filesystem->clean_path($directory);
$dir_len = strlen($directory);
if ($dir_len > 1 && $directory[$dir_len - 1] === '/')