[feature/extension-manager] Don't use the extension manager during install

Template needs to be able to work without extensions.

PHPBB3-10323
This commit is contained in:
Nils Adermann 2011-08-30 19:15:38 -04:00
parent ea46feb115
commit 482a8c47ea
2 changed files with 12 additions and 10 deletions

View file

@ -33,7 +33,7 @@ class phpbb_template_path_provider extends phpbb_extension_provider
* *
* @param phpbb_extension_manager $extension_manager phpBB extension manager * @param phpbb_extension_manager $extension_manager phpBB extension manager
*/ */
public function __construct(phpbb_extension_manager $extension_manager) public function __construct(phpbb_extension_manager $extension_manager = null)
{ {
// no super call to avoid find() call // no super call to avoid find() call
$this->extension_manager = $extension_manager; $this->extension_manager = $extension_manager;
@ -61,18 +61,20 @@ class phpbb_template_path_provider extends phpbb_extension_provider
*/ */
public function find() public function find()
{ {
$finder = $this->extension_manager->get_finder();
$directories = array(); $directories = array();
foreach ($this->templates as $name => $path) if ($this->extension_manager)
{ {
if ($path && !phpbb_is_absolute($path)) $finder = $this->extension_manager->get_finder();
foreach ($this->templates as $name => $path)
{ {
$directories = array_merge($directories, $finder if ($path && !phpbb_is_absolute($path))
->directory('/' . $this->ext_dir_prefix . $path) {
->get_directories() $directories = array_merge($directories, $finder
); ->directory('/' . $this->ext_dir_prefix . $path)
->get_directories()
);
}
} }
} }

View file

@ -203,7 +203,7 @@ $config = new phpbb_config(array(
)); ));
$phpbb_template_locator = new phpbb_template_locator(); $phpbb_template_locator = new phpbb_template_locator();
$phpbb_template_path_provider = new phpbb_template_path_provider($phpbb_extension_manager); $phpbb_template_path_provider = new phpbb_template_path_provider();
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_template_locator, $phpbb_template_path_provider); $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_template_locator, $phpbb_template_path_provider);
$template->set_ext_dir_prefix('adm/'); $template->set_ext_dir_prefix('adm/');
$template->set_custom_template('../adm/style', 'admin'); $template->set_custom_template('../adm/style', 'admin');