diff options
| author | kasimi <mail@kasimi.net> | 2017-04-28 16:58:08 +0200 | 
|---|---|---|
| committer | kasimi <mail@kasimi.net> | 2017-04-28 16:58:08 +0200 | 
| commit | 90a80b7b31e94985e53ddccc8a13117c0c4e7fcf (patch) | |
| tree | 9637adc4effd754e3b53cb44ac7ef05c5d26ddb8 /phpBB/phpbb/extension/manager.php | |
| parent | e6b7defd3818771d27ab2b3aa0e7d9a8448fc4e7 (diff) | |
| download | forums-90a80b7.tar forums-90a80b7.tar.gz forums-90a80b7.tar.bz2 forums-90a80b7.tar.xz forums-90a80b7.zip | |
[ticket/15187] Fail gracefully if template service is unavailable
Diffstat (limited to 'phpBB/phpbb/extension/manager.php')
| -rw-r--r-- | phpBB/phpbb/extension/manager.php | 43 | 
1 files changed, 22 insertions, 21 deletions
| diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 7045624f28..81e6f57b79 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -228,7 +228,7 @@ class manager  		{  			$this->config->increment('assets_version', 1); -			$this->update_template_paths($name, $this->container->get('template')); +			$this->update_template_paths($name);  		}  		return !$active; @@ -595,34 +595,35 @@ class manager  	/**  	* Make the template aware of ACP template events of a newly enabled extension  	* -	* @param string						$name		The extension's name -	* @param \phpbb\template\base|null	$template	The template service +	* @param string $name The extension's name  	* @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( -				$this->phpbb_root_path . 'ext/' . $name . '/adm/style', -				$this->phpbb_root_path . 'ext/' . $name . '/styles', -			); +			return; +		} + +		$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'); +		$paths = array_filter($possible_paths, 'is_dir'); -			if ($paths) -			{ -				$names = array( -					array( -						'name' 		=> 'adm', -						'ext_path' 	=> 'adm/style/', -					), -				); +		if ($paths) +		{ +			$names = array( +				array( +					'name' 		=> 'adm', +					'ext_path' 	=> 'adm/style/', +				), +			); -				$paths[] = $this->phpbb_root_path . 'adm/style'; +			$paths[] = $this->phpbb_root_path . 'adm/style'; -				$template->set_custom_style($names, $paths); -			} +			$this->container->get('template')->set_custom_style($names, $paths);  		}  	}  } | 
