1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-18 22:58:10 +01:00

[ticket/10844] Add phpbb_root_path to phpbb_style_extension_path_provider

The phpbb_root_path needs to be removed from the style path, before giving
the path to the finder, because the finder prepends it later again and is
therefor unable to find style files when the root path is not ./

PHPBB3-10844
This commit is contained in:
Joas Schilling 2013-04-01 10:34:06 +02:00
parent c25dfef770
commit 6a3d77d76e
4 changed files with 17 additions and 3 deletions

View File

@ -242,6 +242,7 @@ services:
arguments:
- @ext.manager
- @style.path_provider
- %core.root_path%
style.path_provider:
class: phpbb_style_path_provider

View File

@ -133,7 +133,7 @@ class bbcode
$this->template_bitfield = new bitfield($user->style['bbcode_bitfield']);
$style_resource_locator = new phpbb_style_resource_locator();
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager);
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template);
$style->set_style();

View File

@ -209,7 +209,7 @@ class messenger
if (!isset($this->tpl_msg[$template_lang . $template_file]))
{
$style_resource_locator = new phpbb_style_resource_locator();
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
$tpl = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager);
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl);

View File

@ -40,17 +40,22 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple
*/
protected $base_path_provider;
/** @var string */
protected $phpbb_root_path;
/**
* Constructor stores extension manager
*
* @param phpbb_extension_manager $extension_manager phpBB extension manager
* @param phpbb_style_path_provider $base_path_provider A simple path provider
* to provide paths to be located in extensions
* @param string $phpbb_root_path phpBB root path
*/
public function __construct(phpbb_extension_manager $extension_manager, phpbb_style_path_provider $base_path_provider)
public function __construct(phpbb_extension_manager $extension_manager, phpbb_style_path_provider $base_path_provider, $phpbb_root_path)
{
parent::__construct($extension_manager);
$this->base_path_provider = $base_path_provider;
$this->phpbb_root_path = $phpbb_root_path;
}
/**
@ -91,6 +96,14 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple
$directories['style'][] = $path;
if ($path && !phpbb_is_absolute($path))
{
// Remove phpBB root path from the style path,
// so the finder is able to find extension styles,
// when the root path is not ./
if (strpos($path, $this->phpbb_root_path) === 0)
{
$path = substr($path, strlen($this->phpbb_root_path));
}
$result = $finder->directory('/' . $this->ext_dir_prefix . $path)
->get_directories(true, false, true);
foreach ($result as $ext => $ext_path)