mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11152] Create separate function for debug-dependent container
PHPBB3-11152
This commit is contained in:
parent
231d743ba9
commit
8851b797fb
4 changed files with 27 additions and 11 deletions
|
@ -100,7 +100,7 @@ $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_pat
|
|||
$phpbb_class_loader_ext->register();
|
||||
|
||||
// Set up container
|
||||
$phpbb_container = phpbb_create_compiled_container(
|
||||
$phpbb_container = phpbb_create_dumped_container_unless_debug(
|
||||
array(
|
||||
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
|
||||
new phpbb_di_extension_core($phpbb_root_path),
|
||||
|
|
|
@ -59,7 +59,7 @@ if (isset($_GET['avatar']))
|
|||
$phpbb_class_loader_ext->register();
|
||||
|
||||
// Set up container
|
||||
$phpbb_container = phpbb_create_compiled_container(
|
||||
$phpbb_container = phpbb_create_dumped_container_unless_debug(
|
||||
array(
|
||||
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
|
||||
new phpbb_di_extension_core($phpbb_root_path),
|
||||
|
|
|
@ -77,14 +77,6 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext)
|
|||
*/
|
||||
function phpbb_create_compiled_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
// Check for our cached container; if it exists, use it
|
||||
$container_filename = phpbb_container_filename($phpbb_root_path, $php_ext);
|
||||
if (file_exists($container_filename))
|
||||
{
|
||||
require($container_filename);
|
||||
return new phpbb_cache_container();
|
||||
}
|
||||
|
||||
// Create a temporary container for access to the ext.manager service
|
||||
$tmp_container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
|
||||
$tmp_container->compile();
|
||||
|
@ -102,6 +94,21 @@ function phpbb_create_compiled_container(array $extensions, array $passes, $phpb
|
|||
}
|
||||
$container->compile();
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
||||
function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
// Check for our cached container; if it exists, use it
|
||||
$container_filename = phpbb_container_filename($phpbb_root_path, $php_ext);
|
||||
if (file_exists($container_filename))
|
||||
{
|
||||
require($container_filename);
|
||||
return new phpbb_cache_container();
|
||||
}
|
||||
|
||||
$container = phpbb_create_compiled_container($extensions, $passes, $phpbb_root_path, $php_ext);
|
||||
|
||||
// Lastly, we create our cached container class
|
||||
$dumper = new PhpDumper($container);
|
||||
$cached_container_dump = $dumper->dump(array(
|
||||
|
@ -114,6 +121,15 @@ function phpbb_create_compiled_container(array $extensions, array $passes, $phpb
|
|||
return $container;
|
||||
}
|
||||
|
||||
function phpbb_create_dumped_container_unless_debug(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
if (defined('DEBUG')) {
|
||||
return phpbb_create_compiled_container($extensions, $passes, $phpbb_root_path, $php_ext);
|
||||
}
|
||||
|
||||
return phpbb_create_dumped_container($extensions, $passes, $phpbb_root_path, $php_ext);
|
||||
}
|
||||
|
||||
function phpbb_container_filename($phpbb_root_path, $php_ext)
|
||||
{
|
||||
$filename = str_replace(array('/', '.'), array('slash', 'dot'), $phpbb_root_path);
|
||||
|
|
|
@ -117,7 +117,7 @@ $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_pat
|
|||
$phpbb_class_loader_ext->register();
|
||||
|
||||
// Set up container
|
||||
$phpbb_container = phpbb_create_compiled_container(
|
||||
$phpbb_container = phpbb_create_dumped_container_unless_debug(
|
||||
array(
|
||||
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
|
||||
new phpbb_di_extension_core($phpbb_root_path),
|
||||
|
|
Loading…
Add table
Reference in a new issue