diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-07-21 16:14:21 +0200 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-07-21 16:14:40 +0200 |
commit | 32d2ee61f78e3aeaac5f4f1bcb672c67aa10b10e (patch) | |
tree | 198cb2d66e4d99e7bb55d3f6355a7618c19b95a0 /phpBB/common.php | |
parent | 5d57caee58c58d2a9c283abe8fe88f4eaec9f662 (diff) | |
download | forums-32d2ee61f78e3aeaac5f4f1bcb672c67aa10b10e.tar forums-32d2ee61f78e3aeaac5f4f1bcb672c67aa10b10e.tar.gz forums-32d2ee61f78e3aeaac5f4f1bcb672c67aa10b10e.tar.bz2 forums-32d2ee61f78e3aeaac5f4f1bcb672c67aa10b10e.tar.xz forums-32d2ee61f78e3aeaac5f4f1bcb672c67aa10b10e.zip |
[feature/dic] Configure container via config.php, use compiler pass
PHPBB3-10739
Diffstat (limited to 'phpBB/common.php')
-rw-r--r-- | phpBB/common.php | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/phpBB/common.php b/phpBB/common.php index a69b26c006..e7dabec4ca 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -8,6 +8,11 @@ * Minimum Requirement: PHP 5.3.2 */ +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\Compiler\Compiler; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + /** */ if (!defined('IN_PHPBB')) @@ -15,11 +20,6 @@ if (!defined('IN_PHPBB')) exit; } -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\EventDispatcher\EventDispatcher; - require($phpbb_root_path . 'includes/startup.' . $phpEx); if (file_exists($phpbb_root_path . 'config.' . $phpEx)) @@ -77,25 +77,26 @@ if (!empty($load_extensions) && function_exists('dl')) // Include files require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +require($phpbb_root_path . 'includes/di/compiler/config_pass.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); -require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); +require($phpbb_root_path . 'includes/db/' . ltrim($dbms, 'dbal_') . '.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); $phpbb_container = new ContainerBuilder(); $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/config')); -$loader->load('parameters.yml'); $loader->load('services.yml'); -$phpbb_container->setParameter('core.root_path', $phpbb_root_path); -$phpbb_container->setParameter('core.php_ext', $phpEx); -$phpbb_container->set('container', $phpbb_container); +$phpbb_compiler = new Compiler(); +$phpbb_compiler->addPass(new phpbb_di_compiler_config_pass($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx)); +$phpbb_compiler->compile($phpbb_container); // Setup class loader first $phpbb_class_loader = $phpbb_container->get('class_loader'); |