Exemple #1
0
require $phpbb_root_path . 'includes/startup.' . $phpEx;
require $phpbb_root_path . 'phpbb/class_loader.' . $phpEx;
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
extract($phpbb_config_php_file->get_all());
if (!defined('PHPBB_ENVIRONMENT')) {
    @define('PHPBB_ENVIRONMENT', 'production');
}
require $phpbb_root_path . 'includes/constants.' . $phpEx;
require $phpbb_root_path . 'includes/functions.' . $phpEx;
require $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
require $phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx;
$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx);
$phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file);
$phpbb_container_builder->without_cache();
$input = new ArgvInput();
if ($input->hasParameterOption(array('--safe-mode'))) {
    $phpbb_container_builder->without_extensions();
} else {
    $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
    $phpbb_class_loader_ext->register();
}
$phpbb_container = $phpbb_container_builder->get_container();
$phpbb_container->get('request')->enable_super_globals();
require $phpbb_root_path . 'includes/compatibility_globals.' . $phpEx;
/* @var $user \phpbb\user */
$user = $phpbb_container->get('user');
$user->add_lang('acp/common');
$user->add_lang('cli');
$lang = $phpbb_container->get('language');
 /**
  * Loads the ContainerBuilder from the cache.
  * @return \Symfony\Component\DependencyInjection\ContainerBuilder
  * @throws \LogicException
  */
 protected function getContainerBuilder()
 {
     $phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext);
     if (version_compare($this->config['version'], '3.2.*', '<')) {
         $container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $this->phpbb_root_path, $this->php_ext);
         $container_builder->set_compile_container(true);
         $container_builder->set_dump_container(false);
         $container = $container_builder->get_container();
     } else {
         $this->request->enable_super_globals();
         $container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext);
         $container_builder->without_cache();
         $container = $container_builder->with_config($phpbb_config_php_file)->get_container();
         $this->request->disable_super_globals();
     }
     return $container;
 }