1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[task/config-class] Implemented a config class to replace the global array.

There is a phpbb_config class which simply holds an array and does not persist
any data. It implements ArrayAccess, Countable and IteratorAggregate to allow
regular use of configuration as if it was still an array. The phpbb_config_db
class depends on an instance of the dbal and a cache driver. It obtains the
configuration data from cache and database as necessary and persists data to
the database.

The functions set_config and set_config_count remain for backward compatability
but they only call methods on the new config class now instead of directly
manipulating the database and cache.

PHPBB3-9988
This commit is contained in:
Nils Adermann
2011-01-10 02:27:18 +01:00
parent 5ea59ba322
commit fb2642bbc6
20 changed files with 703 additions and 154 deletions

View File

@@ -152,9 +152,16 @@ class phpbb_captcha_gd extends phpbb_default_captcha
global $config;
$config_old = $config;
$config = new phpbb_config(array());
foreach ($old_config as $key => $value)
{
$config->set($key, $value);
}
foreach ($this->captcha_vars as $captcha_var => $template_var)
{
$config[$captcha_var] = request_var($captcha_var, (int) $config[$captcha_var]);
$config->set($captcha_var, request_var($captcha_var, (int) $config[$captcha_var]));
}
parent::execute_demo();
$config = $config_old;