aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-06-27 20:08:26 +0200
committerTristan Darricau <github@nicofuma.fr>2014-07-07 01:02:12 +0200
commit01c25d3d6b1d09389a6cbd5808832ed5d146b6d6 (patch)
treea08650cb6c20590c27341e1ce88a6bc2eb8d4876 /phpBB
parentb9995405cf1c2694c0b4848e43c9de0454717b27 (diff)
downloadforums-01c25d3d6b1d09389a6cbd5808832ed5d146b6d6.tar
forums-01c25d3d6b1d09389a6cbd5808832ed5d146b6d6.tar.gz
forums-01c25d3d6b1d09389a6cbd5808832ed5d146b6d6.tar.bz2
forums-01c25d3d6b1d09389a6cbd5808832ed5d146b6d6.tar.xz
forums-01c25d3d6b1d09389a6cbd5808832ed5d146b6d6.zip
[ticket/12775] Use the config.php handler in \phpbb\config_php
PHPBB3-12775
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/phpbb/di/container_factory.php25
-rw-r--r--phpBB/phpbb/di/extension/config.php24
2 files changed, 19 insertions, 30 deletions
diff --git a/phpBB/phpbb/di/container_factory.php b/phpBB/phpbb/di/container_factory.php
index 37fe9f486f..dd348d8eee 100644
--- a/phpBB/phpbb/di/container_factory.php
+++ b/phpBB/phpbb/di/container_factory.php
@@ -43,13 +43,6 @@ class container_factory
protected $installed_exts = null;
/**
- * The content of the php config file
- *
- * @var array
- */
- protected $config_data = array();
-
- /**
* Indicates if the php config file should be injecting into the container (default to true).
*
* @var bool
@@ -142,8 +135,7 @@ class container_factory
if ($this->inject_config)
{
- $this->config_data = $this->config_php_handler->load_config_file();
- $container_extensions[] = new \phpbb\di\extension\config($this->config_data);
+ $container_extensions[] = new \phpbb\di\extension\config($this->config_php_handler);
}
$this->container = $this->create_container($container_extensions);
@@ -271,15 +263,14 @@ class container_factory
{
if ($this->dbal_connection === null)
{
- $this->config_data = $this->config_php_handler->load_config_file();
- $dbal_driver_class = phpbb_convert_30_dbms_to_31($this->config_data['dbms']);
+ $dbal_driver_class = phpbb_convert_30_dbms_to_31($this->config_php_handler->get('dbms'));
$this->dbal_connection = new $dbal_driver_class();
$this->dbal_connection->sql_connect(
- $this->config_data['dbhost'],
- $this->config_data['dbuser'],
- $this->config_data['dbpasswd'],
- $this->config_data['dbname'],
- $this->config_data['dbport'],
+ $this->config_php_handler->get('dbhost'),
+ $this->config_php_handler->get('dbuser'),
+ $this->config_php_handler->get('dbpasswd'),
+ $this->config_php_handler->get('dbname'),
+ $this->config_php_handler->get('dbport'),
defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK
);
}
@@ -295,7 +286,7 @@ class container_factory
protected function get_installed_extensions()
{
$db = $this->get_dbal_connection();
- $extension_table = $this->config_data['table_prefix'] . 'ext';
+ $extension_table = $this->config_php_handler->get('table_prefix') . 'ext';
$sql = 'SELECT *
FROM ' . $extension_table . '
diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php
index 8a26d44858..b25635d7ae 100644
--- a/phpBB/phpbb/di/extension/config.php
+++ b/phpBB/phpbb/di/extension/config.php
@@ -22,11 +22,11 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class config extends Extension
{
/** @var array */
- protected $config_file_data;
+ protected $config_php;
- public function __construct($config_file_data)
+ public function __construct(\phpbb\config_php $config_php)
{
- $this->config_file_data = $config_file_data;
+ $this->config_php = $config_php;
}
/**
@@ -39,17 +39,15 @@ class config extends Extension
*/
public function load(array $config, ContainerBuilder $container)
{
- extract($this->config_file_data);
-
$container->setParameter('core.adm_relative_path', (isset($phpbb_adm_relative_path) ? $phpbb_adm_relative_path : 'adm/'));
- $container->setParameter('core.table_prefix', $table_prefix);
- $container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
- $container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($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('core.table_prefix', $this->config_php->get('table_prefix'));
+ $container->setParameter('cache.driver.class', $this->convert_30_acm_type($this->config_php->get('acm_type')));
+ $container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($this->config_php->get('dbms')));
+ $container->setParameter('dbal.dbhost', $this->config_php->get('dbhost'));
+ $container->setParameter('dbal.dbuser', $this->config_php->get('dbuser'));
+ $container->setParameter('dbal.dbpasswd', $this->config_php->get('dbpasswd'));
+ $container->setParameter('dbal.dbname', $this->config_php->get('dbname'));
+ $container->setParameter('dbal.dbport', $this->config_php->get('dbport'));
$container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK);
}