aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_container.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-11-10 09:55:17 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-11-10 12:02:56 +0100
commit38e1c4ec5d363900285a6a72ee78f4f2e2943bd0 (patch)
treeb7f77f2fdcde29b8a0ac60d7d93a004249d28ef2 /phpBB/includes/functions_container.php
parent897e8f2e8361839a92acae7e77225ef212e44647 (diff)
downloadforums-38e1c4ec5d363900285a6a72ee78f4f2e2943bd0.tar
forums-38e1c4ec5d363900285a6a72ee78f4f2e2943bd0.tar.gz
forums-38e1c4ec5d363900285a6a72ee78f4f2e2943bd0.tar.bz2
forums-38e1c4ec5d363900285a6a72ee78f4f2e2943bd0.tar.xz
forums-38e1c4ec5d363900285a6a72ee78f4f2e2943bd0.zip
[ticket/11152] Use relative root path in container, one dumped container per path
PHPBB3-11152
Diffstat (limited to 'phpBB/includes/functions_container.php')
-rw-r--r--phpBB/includes/functions_container.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php
index 88adc64882..8e2c9606cd 100644
--- a/phpBB/includes/functions_container.php
+++ b/phpBB/includes/functions_container.php
@@ -78,26 +78,22 @@ 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
- if (file_exists("{$phpbb_root_path}cache/container.$php_ext"))
+ $container_filename = phpbb_container_filename($phpbb_root_path, $php_ext);
+ if (file_exists($container_filename))
{
- require("{$phpbb_root_path}cache/container.$php_ext");
+ require($container_filename);
return new phpbb_cache_container();
}
- // We must use an absolute path in the container because we cannot
- // change the value at runtime when accessing it in different
- // directory levels.
- $phpbb_absolute_path = phpbb_realpath($phpbb_root_path) . '/';
-
// Create a temporary container for access to the ext.manager service
- $tmp_container = phpbb_create_container($extensions, $phpbb_absolute_path, $php_ext);
+ $tmp_container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
$tmp_container->compile();
// Now pass the enabled extension paths into the ext compiler extension
$extensions[] = new phpbb_di_extension_ext($tmp_container->get('ext.manager')->all_enabled());
// Create the final container to be compiled and cached
- $container = phpbb_create_container($extensions, $phpbb_absolute_path, $php_ext);
+ $container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext);
// Compile the container
foreach ($passes as $pass)
@@ -113,7 +109,13 @@ function phpbb_create_compiled_container(array $extensions, array $passes, $phpb
'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
));
- $file = file_put_contents("{$phpbb_absolute_path}cache/container.{$php_ext}", $cached_container_dump);
+ file_put_contents($container_filename, $cached_container_dump);
return $container;
}
+
+function phpbb_container_filename($phpbb_root_path, $php_ext)
+{
+ $filename = str_replace(array('/', '.'), array('slash', 'dot'), $phpbb_root_path);
+ return $phpbb_root_path . 'cache/' . $filename . '_container.' . $php_ext;
+}