1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-04 15:57:45 +02:00

[ticket/12508] Fix usages of the finder

PHPBB3-12508
This commit is contained in:
Joas Schilling
2014-05-06 17:50:46 +02:00
parent c20653dfbe
commit d45c681b40
6 changed files with 23 additions and 20 deletions

View File

@@ -44,17 +44,9 @@ require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
class phpbb_extension_empty_manager extends \phpbb\extension\manager
{
public function __construct()
{
$this->extensions = array();
}
}
$finder = new \phpbb\extension\finder(new \phpbb_extension_empty_manager(), new \phpbb\filesystem(), $phpbb_root_path);
$finder = new \phpbb\extension\finder(new \phpbb\filesystem(), $phpbb_root_path);
$classes = $finder->core_path('phpbb/')
->directory('db/migration/data')
->directory('/db/migration/data')
->get_classes();
$db = new \phpbb\db\driver\sqlite();

View File

@@ -561,14 +561,14 @@ class acp_modules
$directory = $phpbb_root_path . 'includes/' . $module_class . '/info/';
$fileinfo = array();
$finder = $phpbb_extension_manager->get_finder();
$finder = $phpbb_extension_manager->get_finder($use_all_available);
$modules = $finder
->extension_suffix('_module')
->extension_directory("/$module_class")
->core_path("includes/$module_class/info/")
->core_prefix($module_class . '_')
->get_classes(true, $use_all_available);
->get_classes(true);
foreach ($modules as $cur_module)
{

View File

@@ -534,10 +534,20 @@ class manager
/**
* Instantiates a \phpbb\extension\finder.
*
* @param bool $use_all_available Should we load all extensions, or just enabled ones
* @return \phpbb\extension\finder An extension finder instance
*/
public function get_finder()
public function get_finder($use_all_available = false)
{
return new \phpbb\extension\finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
$finder = new \phpbb\extension\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());
}
else
{
$finder->set_extensions($this->all_enabled());
}
return $finder;
}
}