1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 23:25:30 +02:00

[ticket/15187] Fail gracefully if template service is unavailable

This commit is contained in:
kasimi 2017-04-28 16:58:08 +02:00
parent e6b7defd38
commit 90a80b7b31
No known key found for this signature in database
GPG Key ID: 3163AB573241193A

View File

@ -228,7 +228,7 @@ class manager
{ {
$this->config->increment('assets_version', 1); $this->config->increment('assets_version', 1);
$this->update_template_paths($name, $this->container->get('template')); $this->update_template_paths($name);
} }
return !$active; return !$active;
@ -595,34 +595,35 @@ class manager
/** /**
* Make the template aware of ACP template events of a newly enabled extension * Make the template aware of ACP template events of a newly enabled extension
* *
* @param string $name The extension's name * @param string $name The extension's name
* @param \phpbb\template\base|null $template The template service
* @return null * @return null
*/ */
protected function update_template_paths($name, \phpbb\template\base $template = null) protected function update_template_paths($name)
{ {
if ($template instanceof \phpbb\template\base) if (!$this->container->has('template'))
{ {
$possible_paths = array( return;
$this->phpbb_root_path . 'ext/' . $name . '/adm/style', }
$this->phpbb_root_path . 'ext/' . $name . '/styles',
$possible_paths = array(
$this->phpbb_root_path . 'ext/' . $name . '/adm/style',
$this->phpbb_root_path . 'ext/' . $name . '/styles',
);
$paths = array_filter($possible_paths, 'is_dir');
if ($paths)
{
$names = array(
array(
'name' => 'adm',
'ext_path' => 'adm/style/',
),
); );
$paths = array_filter($possible_paths, 'is_dir'); $paths[] = $this->phpbb_root_path . 'adm/style';
if ($paths) $this->container->get('template')->set_custom_style($names, $paths);
{
$names = array(
array(
'name' => 'adm',
'ext_path' => 'adm/style/',
),
);
$paths[] = $this->phpbb_root_path . 'adm/style';
$template->set_custom_style($names, $paths);
}
} }
} }
} }