aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/develop/create_schema_files.php12
-rw-r--r--phpBB/includes/acp/acp_modules.php4
-rw-r--r--phpBB/phpbb/extension/manager.php14
-rw-r--r--tests/controller/helper_route_test.php2
-rw-r--r--tests/extension/finder_test.php5
-rw-r--r--tests/pagination/pagination_test.php6
6 files changed, 23 insertions, 20 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 5490e45afa..b12f5e4d25 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -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();
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 61bae18557..5932f4cddd 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -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)
{
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index cd7289e085..88404b025e 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -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;
}
}
diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php
index df0794a047..3756082be6 100644
--- a/tests/controller/helper_route_test.php
+++ b/tests/controller/helper_route_test.php
@@ -43,11 +43,11 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
);
$finder = new \phpbb\extension\finder(
- $this->extension_manager,
new \phpbb\filesystem(),
dirname(__FILE__) . '/',
new phpbb_mock_cache()
);
+ $finder->set_extensions($this->extension_manager->all_enabled());
$this->provider = new \phpbb\controller\provider();
$this->provider->find_routing_files($finder);
$this->provider->find(dirname(__FILE__) . '/');
diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php
index 8cc5146b33..0cf268d32b 100644
--- a/tests/extension/finder_test.php
+++ b/tests/extension/finder_test.php
@@ -201,7 +201,8 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_get_classes_create_cache()
{
$cache = new phpbb_mock_cache;
- $finder = new \phpbb\extension\finder($this->extension_manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
+ $finder = new \phpbb\extension\finder(new \phpbb\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
+ $finder->set_extensions($this->extension_manager->all_enabled());
$files = $finder->suffix('_class.php')->get_files();
$expected_files = array(
@@ -240,7 +241,6 @@ class phpbb_extension_finder_test extends phpbb_test_case
);
$finder = new \phpbb\extension\finder(
- $this->extension_manager,
new \phpbb\filesystem(),
dirname(__FILE__) . '/',
new phpbb_mock_cache(array(
@@ -249,6 +249,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
),
))
);
+ $finder->set_extensions($this->extension_manager->all_enabled());
$classes = $finder
->core_path($query['core_path'])
diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php
index e233264cc6..4d6fbac20e 100644
--- a/tests/pagination/pagination_test.php
+++ b/tests/pagination/pagination_test.php
@@ -35,16 +35,16 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
->will($this->returnCallback(array($this, 'return_callback_implode')));
$manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array());
- $this->finder = new \phpbb\extension\finder(
- $manager,
+ $finder = new \phpbb\extension\finder(
new \phpbb\filesystem(),
dirname(__FILE__) . '/',
new phpbb_mock_cache()
);
+ $finder->set_extensions($manager->all_enabled());
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
$provider = new \phpbb\controller\provider();
- $provider->find_routing_files($this->finder);
+ $provider->find_routing_files($finder);
$provider->find(dirname(__FILE__) . '/');
$this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php', dirname(__FILE__) . '/');
$this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper);