diff options
author | David King <imkingdavid@gmail.com> | 2012-10-22 12:17:06 -0400 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-11-10 12:02:55 +0100 |
commit | af3f07d8c9d79b305f34eb19aa100786d4a3faf8 (patch) | |
tree | d02f3d72ade57767716f1eb1a65c239bf199bf7b | |
parent | 1e3a5dde7d232054d86f91f6908cc23f8b726fdf (diff) | |
download | forums-af3f07d8c9d79b305f34eb19aa100786d4a3faf8.tar forums-af3f07d8c9d79b305f34eb19aa100786d4a3faf8.tar.gz forums-af3f07d8c9d79b305f34eb19aa100786d4a3faf8.tar.bz2 forums-af3f07d8c9d79b305f34eb19aa100786d4a3faf8.tar.xz forums-af3f07d8c9d79b305f34eb19aa100786d4a3faf8.zip |
[feature/compiled-dic] Fix root path when container is created after install
PHPBB3-11152
-rw-r--r-- | phpBB/includes/functions.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index ac63bd086c..bb98ba4eb9 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5484,6 +5484,23 @@ function phpbb_create_compiled_container(array $extensions, array $passes, $phpb return new phpbb_cache_container(); } + // When the board is first installed, the container is initiall created on + // the send_statistics step in the ACP. In that case, the phpbb_root_path + // is "./../". This becomes forever stored in the cached container as the + // core.root_path property, until the container is deleted and recached + // We need to ensure that this does not happen. + // + // However, if we change the root path here, it will try to create a + // ./adm/cache/container.php later on because the root path is wrong + // We need to store the current $phpbb_root_path for use later and then we + // can change it for the controller + $real_root_path = $phpbb_root_path; + if (defined('ADMIN_START')) + { + // Remove the first instance of ../ in the root path + $phpbb_root_path = preg_replace('/..\//', '', $phpbb_root_path, 1); + } + // If we don't have the cached container class, we make it now // First, we create the temporary container so we can access the // extension_manager @@ -5509,7 +5526,8 @@ function phpbb_create_compiled_container(array $extensions, array $passes, $phpb 'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder', )); - $file = file_put_contents("{$phpbb_root_path}cache/container.$phpEx", $cached_container_dump); + // Use the $real_root_path in case $phpbb_root_path was changed above + $file = file_put_contents("{$real_root_path}cache/container.$phpEx", $cached_container_dump); return $container; } |