mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
96e399db72
2 changed files with 27 additions and 8 deletions
|
@ -13,20 +13,23 @@
|
||||||
|
|
||||||
namespace phpbb\config;
|
namespace phpbb\config;
|
||||||
|
|
||||||
|
use phpbb\cache\driver\driver_interface as cache_interface;
|
||||||
|
use phpbb\db\driver\driver_interface as db_interface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration container class
|
* Configuration container class
|
||||||
*/
|
*/
|
||||||
class db extends \phpbb\config\config
|
class db extends config
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Cache instance
|
* Cache instance
|
||||||
* @var \phpbb\cache\driver\driver_interface
|
* @var cache_interface
|
||||||
*/
|
*/
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database connection
|
* Database connection
|
||||||
* @var \phpbb\db\driver\driver_interface
|
* @var db_interface
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
@ -39,16 +42,28 @@ class db extends \phpbb\config\config
|
||||||
/**
|
/**
|
||||||
* Creates a configuration container with a default set of values
|
* Creates a configuration container with a default set of values
|
||||||
*
|
*
|
||||||
* @param \phpbb\db\driver\driver_interface $db Database connection
|
* @param db_interface $db Database connection
|
||||||
* @param \phpbb\cache\driver\driver_interface $cache Cache instance
|
* @param cache_interface $cache Cache instance
|
||||||
* @param string $table Configuration table name
|
* @param string $table Configuration table name
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, $table)
|
public function __construct(db_interface $db, cache_interface $cache, $table)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
$this->table = $table;
|
$this->table = $table;
|
||||||
|
|
||||||
|
$this->initialise($cache);
|
||||||
|
|
||||||
|
parent::__construct($this->config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise config with database and/or cached entries
|
||||||
|
*
|
||||||
|
* @param cache_interface $cache
|
||||||
|
*/
|
||||||
|
public function initialise(cache_interface $cache)
|
||||||
|
{
|
||||||
if (($config = $cache->get('config')) !== false)
|
if (($config = $cache->get('config')) !== false)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT config_name, config_value
|
$sql = 'SELECT config_name, config_value
|
||||||
|
@ -84,7 +99,7 @@ class db extends \phpbb\config\config
|
||||||
$cache->put('config', $cached_config);
|
$cache->put('config', $cached_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($config);
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,7 +108,7 @@ class db extends \phpbb\config\config
|
||||||
* @param String $key The configuration option's name
|
* @param String $key The configuration option's name
|
||||||
* @param bool $use_cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached
|
* changes too frequently to be efficiently cached
|
||||||
* @return null
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete($key, $use_cache = true)
|
public function delete($key, $use_cache = true)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,6 +72,10 @@ class migrate extends \phpbb\console\command\db\migration_command
|
||||||
$this->migrator->create_migrations_table();
|
$this->migrator->create_migrations_table();
|
||||||
|
|
||||||
$this->cache->purge();
|
$this->cache->purge();
|
||||||
|
if ($this->config instanceof \phpbb\config\db)
|
||||||
|
{
|
||||||
|
$this->config->initialise($this->cache->get_driver());
|
||||||
|
}
|
||||||
|
|
||||||
$this->load_migrations();
|
$this->load_migrations();
|
||||||
$orig_version = $this->config['version'];
|
$orig_version = $this->config['version'];
|
||||||
|
|
Loading…
Add table
Reference in a new issue