1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[feature/extension-manager] Support extensions in subdirectories of ext/

PHPBB3-10323
This commit is contained in:
Nils Adermann
2011-10-14 01:30:50 +02:00
parent f53892c838
commit 4fb9f2101d
6 changed files with 28 additions and 22 deletions

View File

@@ -94,7 +94,9 @@ class phpbb_extension_manager
*/
public function get_extension_path($name, $phpbb_relative = false)
{
return (($phpbb_relative) ? $this->phpbb_root_path : '') . 'ext/' . basename($name) . '/';
$name = str_replace('.', '', $name);
return (($phpbb_relative) ? $this->phpbb_root_path : '') . 'ext/' . $name . '/';
}
/**
@@ -106,7 +108,7 @@ class phpbb_extension_manager
*/
public function get_extension($name)
{
$extension_class_name = 'phpbb_ext_' . $name . '_ext';
$extension_class_name = 'phpbb_ext_' . str_replace('/', '_', $name) . '_ext';
if (class_exists($extension_class_name))
{
@@ -292,13 +294,17 @@ class phpbb_extension_manager
{
$available = array();
$iterator = new DirectoryIterator($this->phpbb_root_path . 'ext/');
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/'));
foreach ($iterator as $file_info)
{
$path = $this->phpbb_root_path . 'ext/' . $file_info->getBasename() . '/';
if (!$file_info->isDot() && $file_info->isDir() && file_exists($path))
if ($file_info->isFile() && $file_info->getFilename() == 'ext' . $this->phpEx)
{
$available[$file_info->getBasename()] = $path;
$ext_name = $iterator->getInnerIterator()->getSubPath();
$ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name);
$available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/';
}
}
ksort($available);