mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 11:28:55 +00:00
[task/config-class] Correctly merge cached config with dynamically loaded data.
PHPBB3-9988
This commit is contained in:
parent
6b1e343d8d
commit
129d3c53bc
2 changed files with 16 additions and 1 deletions
|
@ -52,7 +52,11 @@ class phpbb_config_db extends phpbb_config
|
||||||
FROM ' . $this->table . '
|
FROM ' . $this->table . '
|
||||||
WHERE is_dynamic = 1';
|
WHERE is_dynamic = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$config += $this->db->sql_fetchrowset($result);
|
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$config[$row['config_name']] = $row['config_value'];
|
||||||
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -35,6 +35,17 @@ class phpbb_config_db_test extends phpbb_database_test_case
|
||||||
$this->assertEquals('42', $this->config['bar']);
|
$this->assertEquals('42', $this->config['bar']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_load_cached()
|
||||||
|
{
|
||||||
|
$cache = new phpbb_mock_cache(array('config' => array('x' => 'y')));
|
||||||
|
$this->config = new phpbb_config_db($this->db, $cache, 'phpbb_config');
|
||||||
|
|
||||||
|
$this->assertTrue(!isset($this->config['foo']));
|
||||||
|
$this->assertEquals('42', $this->config['bar']);
|
||||||
|
|
||||||
|
$this->assertEquals('y', $this->config['x']);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_offset_set()
|
public function test_offset_set()
|
||||||
{
|
{
|
||||||
$this->config['foo'] = 'x'; // temporary set
|
$this->config['foo'] = 'x'; // temporary set
|
||||||
|
|
Loading…
Add table
Reference in a new issue