mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/11152] Create separate function for debug-dependent container
PHPBB3-11152
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user