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

[ticket/12508] Only take a list of names for set_extensions()

PHPBB3-12508
This commit is contained in:
Joas Schilling
2014-05-09 09:24:30 +02:00
parent e1707b27ca
commit 6980fbd27b
5 changed files with 17 additions and 9 deletions

View File

@@ -542,11 +542,11 @@ class manager
$finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
if ($use_all_available)
{
$finder->set_extensions($this->all_available());
$finder->set_extensions(array_keys($this->all_available()));
}
else
{
$finder->set_extensions($this->all_enabled());
$finder->set_extensions(array_keys($this->all_enabled()));
}
return $finder;
}

View File

@@ -80,12 +80,20 @@ class finder
/**
* Set the array of extensions
*
* @param array $extensions A list of extensions that should be searched aswell
* @param array $extensions A list of extensions that should be searched aswell
* @param bool $replace_list Should the list be emptied before adding the extensions
* @return \phpbb\finder This object for chaining calls
*/
public function set_extensions(array $extensions)
public function set_extensions(array $extensions, $replace_list = true)
{
$this->extensions = $extensions;
if ($replace_list)
{
$this->extensions = array();
}
foreach ($extensions as $ext_name)
{
$this->extensions[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/';
}
return $this;
}