mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12784] Shearch the "vendor" folders and then the autoload.php files [ticket/12784] Allow the extensions to add a custom auto loader
This commit is contained in:
commit
9cf90d1a84
3 changed files with 35 additions and 0 deletions
|
@ -95,6 +95,8 @@ $phpbb_class_loader->register();
|
||||||
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
|
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
|
||||||
$phpbb_class_loader_ext->register();
|
$phpbb_class_loader_ext->register();
|
||||||
|
|
||||||
|
phpbb_load_extensions_autoloaders($phpbb_root_path);
|
||||||
|
|
||||||
// Set up container
|
// Set up container
|
||||||
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ if (isset($_GET['avatar']))
|
||||||
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
|
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
|
||||||
$phpbb_class_loader_ext->register();
|
$phpbb_class_loader_ext->register();
|
||||||
|
|
||||||
|
phpbb_load_extensions_autoloaders($phpbb_root_path);
|
||||||
|
|
||||||
// Set up container
|
// Set up container
|
||||||
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,37 @@ if (!defined('IN_PHPBB'))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common global functions
|
// Common global functions
|
||||||
|
/**
|
||||||
|
* Load the autoloaders added by the extensions.
|
||||||
|
*
|
||||||
|
* @param string $phpbb_root_path Path to the phpbb root directory.
|
||||||
|
*/
|
||||||
|
function phpbb_load_extensions_autoloaders($phpbb_root_path)
|
||||||
|
{
|
||||||
|
$iterator = new \RecursiveIteratorIterator(
|
||||||
|
new \phpbb\recursive_dot_prefix_filter_iterator(
|
||||||
|
new \RecursiveDirectoryIterator(
|
||||||
|
$phpbb_root_path . 'ext/',
|
||||||
|
\FilesystemIterator::SKIP_DOTS
|
||||||
|
)
|
||||||
|
),
|
||||||
|
\RecursiveIteratorIterator::SELF_FIRST
|
||||||
|
);
|
||||||
|
$iterator->setMaxDepth(2);
|
||||||
|
|
||||||
|
foreach ($iterator as $file_info)
|
||||||
|
{
|
||||||
|
if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2)
|
||||||
|
{
|
||||||
|
$filename = $file_info->getRealPath() . '/autoload.php';
|
||||||
|
if (file_exists($filename))
|
||||||
|
{
|
||||||
|
require $filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Casts a variable to the given type.
|
* Casts a variable to the given type.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue