mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/14957] Do not cache database config entries
PHPBB3-14957
This commit is contained in:
parent
bc96a9f1f6
commit
14fd750b08
6 changed files with 21 additions and 10 deletions
|
@ -5,9 +5,7 @@ services:
|
||||||
- @service_container
|
- @service_container
|
||||||
|
|
||||||
dbal.conn.driver:
|
dbal.conn.driver:
|
||||||
class: %dbal.driver.class%
|
synthetic: true
|
||||||
calls:
|
|
||||||
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
|
|
||||||
|
|
||||||
dbal.tools:
|
dbal.tools:
|
||||||
class: phpbb\db\tools
|
class: phpbb\db\tools
|
||||||
|
|
|
@ -185,6 +185,7 @@ class container_builder
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container->set('config.php', $this->config_php_file);
|
$this->container->set('config.php', $this->config_php_file);
|
||||||
|
$this->inject_dbal_driver();
|
||||||
|
|
||||||
if ($this->compile_container)
|
if ($this->compile_container)
|
||||||
{
|
{
|
||||||
|
@ -303,6 +304,17 @@ class container_builder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inject the dbal connection driver into container
|
||||||
|
*/
|
||||||
|
protected function inject_dbal_driver()
|
||||||
|
{
|
||||||
|
if (!empty($this->config_php_file->get_all()))
|
||||||
|
{
|
||||||
|
$this->container->set('dbal.conn.driver', $this->get_dbal_connection());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get DB connection.
|
* Get DB connection.
|
||||||
*
|
*
|
||||||
|
@ -320,6 +332,7 @@ class container_builder
|
||||||
$this->config_php_file->get('dbpasswd'),
|
$this->config_php_file->get('dbpasswd'),
|
||||||
$this->config_php_file->get('dbname'),
|
$this->config_php_file->get('dbname'),
|
||||||
$this->config_php_file->get('dbport'),
|
$this->config_php_file->get('dbport'),
|
||||||
|
false,
|
||||||
defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK
|
defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.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'),
|
'core.table_prefix' => $this->config_php->get('table_prefix'),
|
||||||
'cache.driver.class' => $this->convert_30_acm_type($this->config_php->get('acm_type')),
|
'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,
|
'dbal.new_link' => defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK,
|
||||||
);
|
);
|
||||||
$parameter_bag = $container->getParameterBag();
|
$parameter_bag = $container->getParameterBag();
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace
|
||||||
$this->assertTrue($container->isFrozen());
|
$this->assertTrue($container->isFrozen());
|
||||||
|
|
||||||
// Checks inject_config
|
// Checks inject_config
|
||||||
$this->assertTrue($container->hasParameter('dbal.dbhost'));
|
$this->assertTrue($container->hasParameter('core.table_prefix'));
|
||||||
|
|
||||||
// Checks use_extensions
|
// Checks use_extensions
|
||||||
$this->assertTrue($container->hasParameter('enabled'));
|
$this->assertTrue($container->hasParameter('enabled'));
|
||||||
|
|
|
@ -10,5 +10,8 @@ services:
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
|
|
||||||
|
dbal.conn.driver:
|
||||||
|
synthetic: true
|
||||||
|
|
||||||
dispatcher:
|
dispatcher:
|
||||||
class: phpbb\db\driver\container_mock
|
class: phpbb\db\driver\container_mock
|
||||||
|
|
|
@ -10,5 +10,8 @@ services:
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
|
|
||||||
|
dbal.conn.driver:
|
||||||
|
synthetic: true
|
||||||
|
|
||||||
dispatcher:
|
dispatcher:
|
||||||
class: phpbb\db\driver\container_mock
|
class: phpbb\db\driver\container_mock
|
||||||
|
|
Loading…
Add table
Reference in a new issue