aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/extension
diff options
context:
space:
mode:
authorjaviexin <javiexin@gmail.com>2017-02-10 00:35:23 +0100
committerjaviexin <javiexin@gmail.com>2017-02-10 00:35:23 +0100
commit7313eb54b4f23c9ccd238e1a368c69bedb452229 (patch)
tree5185955400cbec3fec17439c7b1641feac4c26ed /phpBB/phpbb/extension
parentabd6bd815449ba59c2b5737ebb0b47a55221a01c (diff)
downloadforums-7313eb54b4f23c9ccd238e1a368c69bedb452229.tar
forums-7313eb54b4f23c9ccd238e1a368c69bedb452229.tar.gz
forums-7313eb54b4f23c9ccd238e1a368c69bedb452229.tar.bz2
forums-7313eb54b4f23c9ccd238e1a368c69bedb452229.tar.xz
forums-7313eb54b4f23c9ccd238e1a368c69bedb452229.zip
[ticket/14938] Inconsistency in ext_mgr all_available vs is_available
Made is_available much more strict, in line with the checks in all_available Refactor all_available to use is_available, saving duplicate code. Further simplify is_available by using metadata_manager. Make optional the template object on metadata_manager creation. PHPBB3-14938
Diffstat (limited to 'phpBB/phpbb/extension')
-rw-r--r--phpBB/phpbb/extension/manager.php6
-rw-r--r--phpBB/phpbb/extension/metadata_manager.php4
2 files changed, 5 insertions, 5 deletions
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index 608fd12444..e7e5f83c23 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -149,10 +149,10 @@ class manager
* Instantiates the metadata manager for the extension with the given name
*
* @param string $name The extension name
- * @param \phpbb\template\template $template The template manager
+ * @param \phpbb\template\template $template The template manager or null
* @return \phpbb\extension\metadata_manager Instance of the metadata manager
*/
- public function create_extension_metadata_manager($name, \phpbb\template\template $template)
+ public function create_extension_metadata_manager($name, \phpbb\template\template $template = null)
{
return new \phpbb\extension\metadata_manager($name, $this->config, $this, $template, $this->user, $this->phpbb_root_path);
}
@@ -510,7 +510,7 @@ class manager
*/
public function is_available($name)
{
- $md_manager = $this->create_extension_metadata_manager($name, $this->container->get('template'));
+ $md_manager = $this->create_extension_metadata_manager($name);
try
{
return $md_manager->get_metadata('all') && $md_manager->validate_enable();
diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php
index a64d88fe39..0593cdabe1 100644
--- a/phpBB/phpbb/extension/metadata_manager.php
+++ b/phpBB/phpbb/extension/metadata_manager.php
@@ -72,11 +72,11 @@ class metadata_manager
* @param string $ext_name Name (including vendor) of the extension
* @param \phpbb\config\config $config phpBB Config instance
* @param \phpbb\extension\manager $extension_manager An instance of the phpBB extension manager
- * @param \phpbb\template\template $template phpBB Template instance
+ * @param \phpbb\template\template $template phpBB Template instance or null
* @param \phpbb\user $user User instance
* @param string $phpbb_root_path Path to the phpbb includes directory.
*/
- public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template, \phpbb\user $user, $phpbb_root_path)
+ public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template = null, \phpbb\user $user, $phpbb_root_path)
{
$this->config = $config;
$this->extension_manager = $extension_manager;