mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-10 18:54:08 +02:00
Merge branch 'ticket/14957' into ticket/14957-rhea
This commit is contained in:
@@ -50,6 +50,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).
|
||||
*
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user