aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2017-01-03 21:41:36 +0100
committerMarc Alexander <admin@m-a-styles.de>2017-01-03 21:41:36 +0100
commit072bf470fc252ae5942956df896765c3b0e53e66 (patch)
tree5a0e929f0f41f7283dd75a1815f6f12cdf82dfa9 /phpBB/phpbb
parent56314f4c22491dd5b2aacb2a013850c7f3171be8 (diff)
parent14fd750b087c7c9e31f9701bb08ced08db964d12 (diff)
downloadforums-072bf470fc252ae5942956df896765c3b0e53e66.tar
forums-072bf470fc252ae5942956df896765c3b0e53e66.tar.gz
forums-072bf470fc252ae5942956df896765c3b0e53e66.tar.bz2
forums-072bf470fc252ae5942956df896765c3b0e53e66.tar.xz
forums-072bf470fc252ae5942956df896765c3b0e53e66.zip
Merge branch 'ticket/14957' into ticket/14957-rhea
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/di/container_builder.php32
-rw-r--r--phpBB/phpbb/di/extension/config.php6
2 files changed, 32 insertions, 6 deletions
diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php
index 4d5f189f12..920861a5fb 100644
--- a/phpBB/phpbb/di/container_builder.php
+++ b/phpBB/phpbb/di/container_builder.php
@@ -51,6 +51,11 @@ class container_builder
protected $container;
/**
+ * @var \phpbb\db\driver\driver_interface
+ */
+ protected $dbal_connection = null;
+
+ /**
* Indicates whether extensions should be used (default to true).
*
* @var bool
@@ -197,6 +202,8 @@ class container_builder
$this->container->set('config.php', $this->config_php_file);
}
+ $this->inject_dbal_driver();
+
return $this->container;
}
catch (\Exception $e)
@@ -511,7 +518,32 @@ class container_builder
{
$this->container->setParameter($key, $value);
}
+ }
+ /**
+ * Inject the dbal connection driver into container
+ */
+ protected function inject_dbal_driver()
+ {
+ if (!empty($this->config_php_file) && !empty($this->config_php_file->get_all()))
+ {
+ if ($this->dbal_connection === null)
+ {
+ $dbal_driver_class = $this->config_php_file->convert_30_dbms_to_31($this->config_php_file->get('dbms'));
+ /** @var \phpbb\db\driver\driver_interface $dbal_connection */
+ $this->dbal_connection = new $dbal_driver_class();
+ $this->dbal_connection->sql_connect(
+ $this->config_php_file->get('dbhost'),
+ $this->config_php_file->get('dbuser'),
+ $this->config_php_file->get('dbpasswd'),
+ $this->config_php_file->get('dbname'),
+ $this->config_php_file->get('dbport'),
+ false,
+ defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK
+ );
+ }
+ $this->container->set('dbal.conn.driver', $this->dbal_connection);
+ }
}
/**
diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php
index 7984a783df..8c9de48823 100644
--- a/phpBB/phpbb/di/extension/config.php
+++ b/phpBB/phpbb/di/extension/config.php
@@ -43,12 +43,6 @@ class config extends Extension
'core.adm_relative_path' => $this->config_php->get('phpbb_adm_relative_path') ? $this->config_php->get('phpbb_adm_relative_path') : 'adm/',
'core.table_prefix' => $this->config_php->get('table_prefix'),
'cache.driver.class' => $this->convert_30_acm_type($this->config_php->get('acm_type')),
- 'dbal.driver.class' => $this->config_php->convert_30_dbms_to_31($this->config_php->get('dbms')),
- 'dbal.dbhost' => $this->config_php->get('dbhost'),
- 'dbal.dbuser' => $this->config_php->get('dbuser'),
- 'dbal.dbpasswd' => $this->config_php->get('dbpasswd'),
- 'dbal.dbname' => $this->config_php->get('dbname'),
- 'dbal.dbport' => $this->config_php->get('dbport'),
'dbal.new_link' => defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK,
);
$parameter_bag = $container->getParameterBag();