aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/common.php21
-rw-r--r--phpBB/config/parameters.yml12
-rw-r--r--phpBB/config/services.yml1
-rw-r--r--phpBB/config/tables.yml3
-rw-r--r--phpBB/download/file.php14
-rw-r--r--phpBB/includes/di/compiler/config_pass.php51
-rw-r--r--phpBB/install/index.php15
7 files changed, 87 insertions, 30 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');
diff --git a/phpBB/config/parameters.yml b/phpBB/config/parameters.yml
deleted file mode 100644
index 3c24382fc4..0000000000
--- a/phpBB/config/parameters.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-parameters:
- core.table_prefix: phpbb_
- cache.driver.class: phpbb_cache_driver_file
- dbal.driver.class: dbal_mysqli
- dbal.dbhost:
- dbal.dbuser: root
- dbal.dbpasswd:
- dbal.dbname: phpbb
- dbal.dbport:
- dbal.new_link: false
- tables.config: %core.table_prefix%config
- tables.ext: %core.table_prefix%ext
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index 0141641aaf..20f9d67dd0 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -1,4 +1,5 @@
imports:
+ - { resource: tables.yml }
- { resource: cron_tasks.yml }
services:
diff --git a/phpBB/config/tables.yml b/phpBB/config/tables.yml
new file mode 100644
index 0000000000..cfc6dbcfed
--- /dev/null
+++ b/phpBB/config/tables.yml
@@ -0,0 +1,3 @@
+parameters:
+ tables.config: %core.table_prefix%config
+ tables.ext: %core.table_prefix%ext
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index 7213e3ac3f..d4960dad0d 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -7,6 +7,11 @@
*
*/
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\DependencyInjection\Compiler\Compiler;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
+
/**
* @ignore
*/
@@ -38,6 +43,8 @@ if (isset($_GET['avatar']))
}
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
+ require($phpbb_root_path . 'includes/di/compiler/config_pass.' . $phpEx);
+
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
@@ -46,12 +53,11 @@ if (isset($_GET['avatar']))
$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);
$phpbb_class_loader = $phpbb_container->get('class_loader');
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext');
diff --git a/phpBB/includes/di/compiler/config_pass.php b/phpBB/includes/di/compiler/config_pass.php
new file mode 100644
index 0000000000..9288c1760c
--- /dev/null
+++ b/phpBB/includes/di/compiler/config_pass.php
@@ -0,0 +1,51 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+
+class phpbb_di_compiler_config_pass implements CompilerPassInterface
+{
+ private $config_file;
+
+ public function __construct($config_file, $phpbb_root_path, $php_ext)
+ {
+ $this->config_file = $config_file;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ }
+
+ public function process(ContainerBuilder $container)
+ {
+ require $this->config_file;
+
+ $container->setParameter('core.root_path', $this->phpbb_root_path);
+ $container->setParameter('core.php_ext', $this->php_ext);
+
+ $container->setParameter('core.table_prefix', $table_prefix);
+ $container->setParameter('cache.driver.class', $acm_type);
+ $container->setParameter('dbal.driver.class', $dbms);
+ $container->setParameter('dbal.dbhost', $dbhost);
+ $container->setParameter('dbal.dbuser', $dbuser);
+ $container->setParameter('dbal.dbpasswd', $dbpasswd);
+ $container->setParameter('dbal.dbname', $dbname);
+ $container->setParameter('dbal.dbport', $dbport);
+ $container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK);
+
+ $container->set('container', $container);
+ }
+}
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 88745b8bb9..3e14b719e8 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -7,6 +7,11 @@
*
*/
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\DependencyInjection\Compiler\Compiler;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
+
/**#@+
* @ignore
*/
@@ -71,6 +76,8 @@ else
// Include essential scripts
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);
phpbb_require_updated('includes/functions_content.' . $phpEx, true);
@@ -81,13 +88,13 @@ require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
$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_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);
+
$phpbb_container->setAlias('cache.driver.install', 'cache.driver');
-$phpbb_container->set('container', $phpbb_container);
$phpbb_class_loader = $phpbb_container->get('class_loader');
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext');