diff options
author | javiexin <javiexin@gmail.com> | 2016-12-30 21:50:04 +0100 |
---|---|---|
committer | javiexin <javiexin@gmail.com> | 2016-12-30 21:50:04 +0100 |
commit | 9658ecae8bb2c66bc105cf6787df6b8c40277676 (patch) | |
tree | 7dcd4e29411fbd31d2dd82d73b34dace41a5f9d2 /phpBB/phpbb/extension | |
parent | efc2b46303614b0824d3f58f51778e7ff925ccf5 (diff) | |
download | forums-9658ecae8bb2c66bc105cf6787df6b8c40277676.tar forums-9658ecae8bb2c66bc105cf6787df6b8c40277676.tar.gz forums-9658ecae8bb2c66bc105cf6787df6b8c40277676.tar.bz2 forums-9658ecae8bb2c66bc105cf6787df6b8c40277676.tar.xz forums-9658ecae8bb2c66bc105cf6787df6b8c40277676.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.
PHPBB3-14938
Diffstat (limited to 'phpBB/phpbb/extension')
-rw-r--r-- | phpBB/phpbb/extension/manager.php | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 770c574dd5..036a0fc07d 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -433,25 +433,11 @@ class manager if ($file_info->isFile() && $file_info->getFilename() == 'composer.json') { $ext_name = $iterator->getInnerIterator()->getSubPath(); - $composer_file = $iterator->getPath() . '/composer.json'; - - // Ignore the extension if there is no composer.json. - if (!is_readable($composer_file) || !($ext_info = file_get_contents($composer_file))) - { - continue; - } - - $ext_info = json_decode($ext_info, true); $ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name); - - // Ignore the extension if directory depth is not correct or if the directory structure - // does not match the name value specified in composer.json. - if (substr_count($ext_name, '/') !== 1 || !isset($ext_info['name']) || $ext_name != $ext_info['name']) + if ($this->is_available($ext_name)) { - continue; + $available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; } - - $available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; } } ksort($available); @@ -530,7 +516,7 @@ class manager return false; } - $composer_file = $this->get_extension_path($name, true) . '/composer.json'; + $composer_file = $this->get_extension_path($name, true) . 'composer.json'; // Not available if there is no composer.json. if (!is_readable($composer_file) || !($ext_info = file_get_contents($composer_file))) |