1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-18 06:38:43 +01:00

[ticket/13494] Update calls to set_config()

PHPBB3-13494
This commit is contained in:
Gaëtan Muller 2015-01-11 17:32:31 +01:00
parent 6e2838a4ca
commit 79d4ff5538
45 changed files with 175 additions and 181 deletions

View File

@ -92,7 +92,6 @@ if (isset($_GET['avatar']))
/* @var $config \phpbb\config\config */
$config = $phpbb_container->get('config');
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
// load extensions

View File

@ -190,7 +190,7 @@ class acp_attachments
if ($submit)
{
set_config($config_name, $config_value);
$config->set($config_name, $config_value);
}
}

View File

@ -532,7 +532,7 @@ class acp_board
if ($submit)
{
set_config($config_name, $config_value);
$config->set($config_name, $config_value);
if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))
{
@ -568,7 +568,7 @@ class acp_board
{
if (!isset($config[$field]))
{
set_config($field, '');
$config->set($field, '');
}
if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false)
@ -583,7 +583,7 @@ class acp_board
if ($submit)
{
$updated_auth_settings = true;
set_config($field, $config_value);
$config->set($field, $config_value);
}
}
}
@ -600,11 +600,11 @@ class acp_board
{
foreach ($old_auth_config as $config_name => $config_value)
{
set_config($config_name, $config_value);
$config->set($config_name, $config_value);
}
trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
}
set_config('auth_method', basename($cfg_array['auth_method']));
$config->set('auth_method', basename($cfg_array['auth_method']));
}
else
{

View File

@ -71,7 +71,7 @@ class acp_captcha
{
foreach ($config_vars as $config_var => $options)
{
set_config($config_var, request_var($config_var, $options['default']));
$config->set($config_var, request_var($config_var, $options['default']));
}
if ($selected !== $config['captcha_plugin'])
@ -82,7 +82,7 @@ class acp_captcha
$old_captcha = $factory->get_instance($config['captcha_plugin']);
$old_captcha->uninstall();
set_config('captcha_plugin', $selected);
$config->set('captcha_plugin', $selected);
$new_captcha = $factory->get_instance($config['captcha_plugin']);
$new_captcha->install();

View File

@ -1962,7 +1962,7 @@ class acp_forums
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_posts', (int) $row['stat'], true);
$config->set('num_posts', (int) $row['stat'], false);
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
@ -1971,7 +1971,7 @@ class acp_forums
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_topics', (int) $row['stat'], true);
$config->set('num_topics', (int) $row['stat'], false);
$sql = 'SELECT COUNT(attach_id) as stat
FROM ' . ATTACHMENTS_TABLE;
@ -1979,7 +1979,7 @@ class acp_forums
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_files', (int) $row['stat'], true);
$config->set('num_files', (int) $row['stat'], false);
$sql = 'SELECT SUM(filesize) as stat
FROM ' . ATTACHMENTS_TABLE;
@ -1987,7 +1987,7 @@ class acp_forums
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('upload_dir_size', (float) $row['stat'], true);
$config->set('upload_dir_size', (float) $row['stat'], false);
return array();
}

View File

@ -103,13 +103,13 @@ class acp_jabber
$db->sql_query($sql);
}
set_config('jab_enable', $jab_enable);
set_config('jab_host', $jab_host);
set_config('jab_port', $jab_port);
set_config('jab_username', $jab_username);
set_config('jab_password', $jab_password);
set_config('jab_package_size', $jab_package_size);
set_config('jab_use_ssl', $jab_use_ssl);
$config->set('jab_enable', $jab_enable);
$config->set('jab_host', $jab_host);
$config->set('jab_port', $jab_port);
$config->set('jab_username', $jab_username);
$config->set('jab_password', $jab_password);
$config->set('jab_package_size', $jab_package_size);
$config->set('jab_use_ssl', $jab_use_ssl);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . $log);
trigger_error($message . adm_back_link($this->u_action));

View File

@ -121,8 +121,8 @@ class acp_main
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
set_config('record_online_users', 1, true);
set_config('record_online_date', time(), true);
$config->set('record_online_users', 1, false);
$config->set('record_online_date', time(), false);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_ONLINE');
if ($request->is_ajax())
@ -141,35 +141,35 @@ class acp_main
FROM ' . POSTS_TABLE . '
WHERE post_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
set_config('num_posts', (int) $db->sql_fetchfield('stat'), true);
$config->set('num_posts', (int) $db->sql_fetchfield('stat'), false);
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
WHERE topic_visibility = ' . ITEM_APPROVED;
$result = $db->sql_query($sql);
set_config('num_topics', (int) $db->sql_fetchfield('stat'), true);
$config->set('num_topics', (int) $db->sql_fetchfield('stat'), false);
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(user_id) AS stat
FROM ' . USERS_TABLE . '
WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
set_config('num_users', (int) $db->sql_fetchfield('stat'), true);
$config->set('num_users', (int) $db->sql_fetchfield('stat'), false);
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(attach_id) as stat
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
$result = $db->sql_query($sql);
set_config('num_files', (int) $db->sql_fetchfield('stat'), true);
$config->set('num_files', (int) $db->sql_fetchfield('stat'), false);
$db->sql_freeresult($result);
$sql = 'SELECT SUM(filesize) as stat
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
$result = $db->sql_query($sql);
set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true);
$config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false);
$db->sql_freeresult($result);
if (!function_exists('update_last_username'))
@ -259,7 +259,7 @@ class acp_main
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
set_config('board_startdate', time() - 1);
$config->set('board_startdate', time() - 1);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_DATE');
if ($request->is_ajax())
@ -664,7 +664,7 @@ class acp_main
// Fill dbms version if not yet filled
if (empty($config['dbms_version']))
{
set_config('dbms_version', $db->sql_server_info(true));
$config->set('dbms_version', $db->sql_server_info(true));
}
$this->tpl_name = 'acp_main';

View File

@ -133,7 +133,7 @@ class acp_search
// only change config if anything was actually changed
if ($submit && ($config[$config_name] != $config_value))
{
set_config($config_name, $config_value);
$config->set($config_name, $config_value);
$updated = true;
}
}
@ -157,7 +157,7 @@ class acp_search
{
if (!method_exists($search, 'init') || !($error = $search->init()))
{
set_config('search_type', $cfg_array['search_type']);
$config->set('search_type', $cfg_array['search_type']);
if (!$updated)
{
@ -578,6 +578,8 @@ class acp_search
function save_state($state = false)
{
global $config;
if ($state)
{
$this->state = $state;
@ -585,7 +587,7 @@ class acp_search
ksort($this->state);
set_config('search_indexing_state', implode(',', $this->state), true);
$config->set('search_indexing_state', implode(',', $this->state), true);
}
/**

View File

@ -38,7 +38,7 @@ class acp_send_statistics
if (!isset($config['questionnaire_unique_id']))
{
$install_id = unique_id();
set_config('questionnaire_unique_id', $install_id);
$config->set('questionnaire_unique_id', $install_id);
}
else
{

View File

@ -32,6 +32,9 @@ class acp_styles
protected $styles_list_cols = 0;
protected $reserved_style_names = array('adm', 'admin', 'all');
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver\driver_interface */
protected $db;
@ -538,7 +541,7 @@ class acp_styles
{
trigger_error($this->user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING);
}
set_config('default_style', $id);
$this->config->set('default_style', $id);
$this->cache->purge();
}

View File

@ -44,7 +44,6 @@ request_var('', 0, false, false, $request); // "dependency injection" for a func
// Grab global variables, re-cache if necessary
/* @var $config phpbb\config\db */
$config = $phpbb_container->get('config');
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
/* @var $phpbb_log \phpbb\log\log_interface */

View File

@ -129,39 +129,6 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $
return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? \phpbb\request\request_interface::COOKIE : \phpbb\request\request_interface::REQUEST);
}
/**
* Sets a configuration option's value.
*
* Please note that this function does not update the is_dynamic value for
* an already existing config option.
*
* @param string $config_name The configuration option's name
* @param string $config_value New configuration value
* @param bool $is_dynamic Whether this variable should be cached (false) or
* if it changes too frequently (true) to be
* efficiently cached.
*
* @return null
*
* @deprecated
*/
function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null)
{
static $config = null;
if ($set_config !== null)
{
$config = $set_config;
if (empty($config_name))
{
return;
}
}
$config->set($config_name, $config_value, !$is_dynamic);
}
/**
* Increments an integer config value directly in the database.
*
@ -235,8 +202,8 @@ function unique_id($extra = 'c')
if ($dss_seeded !== true && ($config['rand_seed_last_update'] < time() - rand(1,10)))
{
set_config('rand_seed_last_update', time(), true);
set_config('rand_seed', $config['rand_seed'], true);
$config->set('rand_seed_last_update', time(), false);
$config->set('rand_seed', $config['rand_seed'], false);
$dss_seeded = true;
}
@ -4783,8 +4750,8 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
if ($total_online_users > $config['record_online_users'])
{
set_config('record_online_users', $total_online_users, true);
set_config('record_online_date', time(), true);
$config->set('record_online_users', $total_online_users, false);
$config->set('record_online_date', time(), false);
}
$l_online_record = $user->lang('RECORD_ONLINE_USERS', (int) $config['record_online_users'], $user->format_date($config['record_online_date'], false, true));

View File

@ -3040,7 +3040,7 @@ function tidy_warnings()
$db->sql_transaction('commit');
}
set_config('warnings_last_gc', time(), true);
$config->set('warnings_last_gc', time(), false);
}
/**
@ -3048,7 +3048,7 @@ function tidy_warnings()
*/
function tidy_database()
{
global $db;
global $config, $db;
// Here we check permission consistency
@ -3073,7 +3073,7 @@ function tidy_database()
WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true);
$db->sql_query($sql);
set_config('database_last_gc', time(), true);
$config->set('database_last_gc', time(), false);
}
/**

View File

@ -264,3 +264,36 @@ function add_log()
return $phpbb_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data);
}
/**
* Sets a configuration option's value.
*
* Please note that this function does not update the is_dynamic value for
* an already existing config option.
*
* @param string $config_name The configuration option's name
* @param string $config_value New configuration value
* @param bool $is_dynamic Whether this variable should be cached (false) or
* if it changes too frequently (true) to be
* efficiently cached.
*
* @return null
*
* @deprecated 3.1.0 (To be removed: 3.3.0)
*/
function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null)
{
static $config = null;
if ($set_config !== null)
{
$config = $set_config;
if (empty($config_name))
{
return;
}
}
$config->set($config_name, $config_value, !$is_dynamic);
}

View File

@ -1312,7 +1312,7 @@ function restore_config($schema)
$config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, 255, false);
}
set_config($config_name, $config_value);
$config->set($config_name, $config_value);
}
}
}
@ -1968,9 +1968,9 @@ function update_dynamic_config()
if ($row)
{
set_config('newest_user_id', $row['user_id'], true);
set_config('newest_username', $row['username'], true);
set_config('newest_user_colour', $row['user_colour'], true);
$config->set('newest_user_id', $row['user_id'], false);
$config->set('newest_username', $row['username'], false);
$config->set('newest_user_colour', $row['user_colour'], false);
}
// Also do not reset record online user/date. There will be old data or the fresh data from the schema.
@ -1984,7 +1984,7 @@ function update_dynamic_config()
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_posts', (int) $row['stat'], true);
$config->set('num_posts', (int) $row['stat'], false);
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
@ -1993,7 +1993,7 @@ function update_dynamic_config()
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_topics', (int) $row['stat'], true);
$config->set('num_topics', (int) $row['stat'], false);
$sql = 'SELECT COUNT(user_id) AS stat
FROM ' . USERS_TABLE . '
@ -2002,20 +2002,20 @@ function update_dynamic_config()
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_users', (int) $row['stat'], true);
$config->set('num_users', (int) $row['stat'], false);
$sql = 'SELECT COUNT(attach_id) as stat
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
$result = $db->sql_query($sql);
set_config('num_files', (int) $db->sql_fetchfield('stat'), true);
$config->set('num_files', (int) $db->sql_fetchfield('stat'), false);
$db->sql_freeresult($result);
$sql = 'SELECT SUM(filesize) as stat
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
$result = $db->sql_query($sql);
set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true);
$config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false);
$db->sql_freeresult($result);
/**

View File

@ -717,14 +717,14 @@ class queue
{
if (!$have_cache_file)
{
set_config('last_queue_run', time(), true);
$config->set('last_queue_run', time(), false);
}
$lock->release();
return;
}
set_config('last_queue_run', time(), true);
$config->set('last_queue_run', time(), false);
include($this->cache_file);

View File

@ -89,7 +89,7 @@ function user_get_id_name(&$user_id_ary, &$username_ary, $user_type = false)
*/
function update_last_username()
{
global $db;
global $config, $db;
// Get latest username
$sql = 'SELECT user_id, username, user_colour
@ -102,9 +102,9 @@ function update_last_username()
if ($row)
{
set_config('newest_user_id', $row['user_id'], true);
set_config('newest_username', $row['username'], true);
set_config('newest_user_colour', $row['user_colour'], true);
$config->set('newest_user_id', $row['user_id'], false);
$config->set('newest_username', $row['username'], false);
$config->set('newest_user_colour', $row['user_colour'], false);
}
}
@ -138,7 +138,7 @@ function user_update_name($old_name, $new_name)
if ($config['newest_username'] == $old_name)
{
set_config('newest_username', $new_name, true);
$config->set('newest_username', $new_name, false);
}
/**
@ -335,8 +335,8 @@ function user_add($user_row, $cp_data = false, $notifications_data = null)
// set the newest user and adjust the user count if the user is a normal user and no activation mail is sent
if ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_FOUNDER)
{
set_config('newest_user_id', $user_id, true);
set_config('newest_username', $user_row['username'], true);
$config->set('newest_user_id', $user_id, false);
$config->set('newest_username', $user_row['username'], false);
set_config_count('num_users', 1, true);
$sql = 'SELECT group_colour
@ -346,7 +346,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null)
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('newest_user_colour', $row['group_colour'], true);
$config->set('newest_user_colour', $row['group_colour'], false);
}
// Use default notifications settings if notifications_data is not set
@ -3193,7 +3193,7 @@ function group_validate_groupname($group_id, $group_name)
*/
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false)
{
global $phpbb_container, $db, $phpbb_dispatcher;
global $config, $phpbb_container, $db, $phpbb_dispatcher;
if (empty($user_id_ary))
{
@ -3263,8 +3263,8 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
if (isset($sql_ary[$avatar_option]))
{
$avatar_sql_ary[$avatar_option] = $sql_ary[$avatar_option];
}
}
}
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $avatar_sql_ary) . "
@ -3305,11 +3305,9 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary);
$db->sql_query($sql);
global $config;
if (in_array($config['newest_user_id'], $user_id_ary))
{
set_config('newest_user_colour', $sql_ary['user_colour'], true);
$config->set('newest_user_colour', $sql_ary['user_colour'], false);
}
}

View File

@ -230,7 +230,7 @@ class phpbb_questionnaire_phpbb_data_provider
if (empty($config['questionnaire_unique_id']))
{
$this->unique_id = unique_id();
set_config('questionnaire_unique_id', $this->unique_id);
$config->set('questionnaire_unique_id', $this->unique_id);
}
else
{

View File

@ -233,11 +233,11 @@ if (!$get_info)
$user_id = (int) $src_db->sql_fetchfield('max_user_id');
$src_db->sql_freeresult($result);
set_config('increment_user_id', ($user_id + 1), true);
$config->set('increment_user_id', ($user_id + 1), false);
}
else
{
set_config('increment_user_id', 0, true);
$config->set('increment_user_id', 0, false);
}
// Overwrite maximum avatar width/height

View File

@ -514,12 +514,12 @@ function phpbb_user_id($user_id)
// If there is a user id 1, we need to increment user ids. :/
if ($id === 1)
{
set_config('increment_user_id', ($max_id + 1), true);
$config->set('increment_user_id', ($max_id + 1), false);
$config['increment_user_id'] = $max_id + 1;
}
else
{
set_config('increment_user_id', 0, true);
$config->set('increment_user_id', 0, false);
$config['increment_user_id'] = 0;
}
}
@ -1682,29 +1682,29 @@ function phpbb_import_attach_config()
}
$src_db->sql_freeresult($result);
set_config('allow_attachments', 1);
$config->set('allow_attachments', 1);
// old attachment mod? Must be very old if this entry do not exist...
if (!empty($attach_config['display_order']))
{
set_config('display_order', $attach_config['display_order']);
$config->set('display_order', $attach_config['display_order']);
}
set_config('max_filesize', $attach_config['max_filesize']);
set_config('max_filesize_pm', $attach_config['max_filesize_pm']);
set_config('attachment_quota', $attach_config['attachment_quota']);
set_config('max_attachments', $attach_config['max_attachments']);
set_config('max_attachments_pm', $attach_config['max_attachments_pm']);
set_config('allow_pm_attach', $attach_config['allow_pm_attach']);
$config->set('max_filesize', $attach_config['max_filesize']);
$config->set('max_filesize_pm', $attach_config['max_filesize_pm']);
$config->set('attachment_quota', $attach_config['attachment_quota']);
$config->set('max_attachments', $attach_config['max_attachments']);
$config->set('max_attachments_pm', $attach_config['max_attachments_pm']);
$config->set('allow_pm_attach', $attach_config['allow_pm_attach']);
set_config('img_display_inlined', $attach_config['img_display_inlined']);
set_config('img_max_width', $attach_config['img_max_width']);
set_config('img_max_height', $attach_config['img_max_height']);
set_config('img_link_width', $attach_config['img_link_width']);
set_config('img_link_height', $attach_config['img_link_height']);
set_config('img_create_thumbnail', $attach_config['img_create_thumbnail']);
set_config('img_max_thumb_width', 400);
set_config('img_min_thumb_filesize', $attach_config['img_min_thumb_filesize']);
set_config('img_imagick', $attach_config['img_imagick']);
$config->set('img_display_inlined', $attach_config['img_display_inlined']);
$config->set('img_max_width', $attach_config['img_max_width']);
$config->set('img_max_height', $attach_config['img_max_height']);
$config->set('img_link_width', $attach_config['img_link_width']);
$config->set('img_link_height', $attach_config['img_link_height']);
$config->set('img_create_thumbnail', $attach_config['img_create_thumbnail']);
$config->set('img_max_thumb_width', 400);
$config->set('img_min_thumb_filesize', $attach_config['img_min_thumb_filesize']);
$config->set('img_imagick', $attach_config['img_imagick']);
}
/**

View File

@ -115,7 +115,6 @@ request_var('', 0, false, false, $request); // "dependency injection" for a func
// Grab global variables, re-cache if necessary
/* @var $config \phpbb\config\config */
$config = $phpbb_container->get('config');
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
if (!isset($config['version_update_from']))

View File

@ -150,7 +150,6 @@ class install_convert extends module
// We need to fill the config to let internal functions correctly work
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
// Detect if there is already a conversion in progress at this point and offer to resume
@ -391,7 +390,6 @@ class install_convert extends module
// We need to fill the config to let internal functions correctly work
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
$convertor_tag = request_var('tag', '');
@ -534,24 +532,27 @@ class install_convert extends module
if (!sizeof($error))
{
// Save convertor Status
set_config('convert_progress', serialize(array(
$config->set('convert_progress', serialize(array(
'step' => '',
'table_prefix' => $src_table_prefix,
'tag' => $convertor_tag,
)), true);
set_config('convert_db_server', serialize(array(
)), false);
$config->set('convert_db_server', serialize(array(
'dbms' => $src_dbms,
'dbhost' => $src_dbhost,
'dbport' => $src_dbport,
'dbname' => $src_dbname,
)), true);
set_config('convert_db_user', serialize(array(
)), false);
$config->set('convert_db_user', serialize(array(
'dbuser' => $src_dbuser,
'dbpasswd' => $src_dbpasswd,
)), true);
)), false);
// Save options
set_config('convert_options', serialize(array('forum_path' => './../' . $forum_path, 'refresh' => $refresh)), true);
$config->set('convert_options', serialize(array(
'forum_path' => './../' . $forum_path,
'refresh' => $refresh
)), false);
$template->assign_block_vars('checks', array(
'TITLE' => $lang['VERIFY_OPTIONS'],
@ -635,7 +636,6 @@ class install_convert extends module
// We need to fill the config to let internal functions correctly work
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
// Override a couple of config variables for the duration
@ -788,7 +788,7 @@ class install_convert extends module
if (!class_exists($search_type))
{
$search_type = '\phpbb\search\fulltext_native';
set_config('search_type', $search_type);
$config->set('search_type', $search_type);
}
if (!class_exists($search_type))
@ -1561,26 +1561,26 @@ class install_convert extends module
*/
function save_convert_progress($step)
{
global $convert, $language;
global $config, $convert, $language;
// Save convertor Status
set_config('convert_progress', serialize(array(
$config->set('convert_progress', serialize(array(
'step' => $step,
'table_prefix' => $convert->src_table_prefix,
'tag' => $convert->convertor_tag,
)), true);
)), false);
set_config('convert_db_server', serialize(array(
$config->set('convert_db_server', serialize(array(
'dbms' => $convert->src_dbms,
'dbhost' => $convert->src_dbhost,
'dbport' => $convert->src_dbport,
'dbname' => $convert->src_dbname,
)), true);
)), false);
set_config('convert_db_user', serialize(array(
$config->set('convert_db_user', serialize(array(
'dbuser' => $convert->src_dbuser,
'dbpasswd' => $convert->src_dbpasswd,
)), true);
)), false);
return $this->p_master->module_url . "?mode={$this->mode}&amp;sub=in_progress&amp;tag={$convert->convertor_tag}$step&amp;language=$language";
}
@ -1759,7 +1759,7 @@ class install_convert extends module
if (!isset($config['board_startdate']) || ($row['board_startdate'] < $config['board_startdate'] && $row['board_startdate'] > 0))
{
set_config('board_startdate', $row['board_startdate']);
$config->set('board_startdate', $row['board_startdate']);
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_regdate = ' . $row['board_startdate'] . ' WHERE user_id = ' . ANONYMOUS);
}

View File

@ -1493,7 +1493,6 @@ class install_install extends module
// We need to fill the config to let internal functions correctly work
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
$error = false;
@ -1910,7 +1909,6 @@ class install_install extends module
// We need to fill the config to let internal functions correctly work
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
$sql = 'SELECT group_id
@ -1984,7 +1982,6 @@ class install_install extends module
// We need to fill the config to let internal functions correctly work
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
$user->session_begin();
@ -2032,12 +2029,12 @@ class install_install extends module
*/
function disable_avatars_if_unwritable()
{
global $phpbb_root_path;
global $config, $phpbb_root_path;
if (!phpbb_is_writable($phpbb_root_path . 'images/avatars/upload/'))
{
set_config('allow_avatar', 0);
set_config('allow_avatar_upload', 0);
$config->set('allow_avatar', 0);
$config->set('allow_avatar_upload', 0);
}
}

View File

@ -115,7 +115,6 @@ class install_update extends module
// We need to fill the config to let internal functions correctly work
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
// Force template recompile
@ -236,7 +235,7 @@ class install_update extends module
// Fill DB version
if (empty($config['dbms_version']))
{
set_config('dbms_version', $db->sql_server_info(true));
$config->set('dbms_version', $db->sql_server_info(true));
}
if ($this->test_update === false)

View File

@ -44,9 +44,11 @@ class eaccelerator extends \phpbb\cache\driver\memory
*/
function tidy()
{
global $config;
eaccelerator_gc();
set_config('cache_last_gc', time(), true);
$config->set('cache_last_gc', time(), false);
}
/**

View File

@ -95,7 +95,7 @@ class file extends \phpbb\cache\driver\base
*/
function tidy()
{
global $phpEx;
global $config, $phpEx;
$dir = @opendir($this->cache_dir);
@ -149,7 +149,7 @@ class file extends \phpbb\cache\driver\base
}
}
set_config('cache_last_gc', time(), true);
$config->set('cache_last_gc', time(), false);
}
/**

View File

@ -81,9 +81,10 @@ abstract class memory extends \phpbb\cache\driver\base
*/
function tidy()
{
// cache has auto GC, no need to have any code here :)
global $config;
set_config('cache_last_gc', time(), true);
// cache has auto GC, no need to have any code here :)
$config->set('cache_last_gc', time(), false);
}
/**

View File

@ -52,8 +52,10 @@ class null extends \phpbb\cache\driver\base
*/
function tidy()
{
global $config;
// This cache always has a tidy room.
set_config('cache_last_gc', time(), true);
$config->set('cache_last_gc', time(), false);
}
/**

View File

@ -80,7 +80,7 @@ class gd extends captcha_abstract
$value = request_var($captcha_var, 0);
if ($value >= 0)
{
set_config($captcha_var, $value);
$config->set($captcha_var, $value);
}
}

View File

@ -97,7 +97,7 @@ class recaptcha extends captcha_abstract
$value = request_var($captcha_var, '');
if ($value)
{
set_config($captcha_var, $value);
$config->set($captcha_var, $value);
}
}

View File

@ -62,6 +62,8 @@ class style_update_p1 extends \phpbb\db\migration\migration
public function styles_update()
{
global $config;
// Get list of valid 3.1 styles
$available_styles = array('prosilver');
@ -163,7 +165,7 @@ class style_update_p1 extends \phpbb\db\migration\migration
$default_style = $this->db->sql_fetchfield($result);
$this->db->sql_freeresult($result);
set_config('default_style', $default_style);
$config->set('default_style', $default_style);
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0';
$this->sql_query($sql);

View File

@ -188,8 +188,8 @@ class fulltext_mysql extends \phpbb\search\base
}
$this->db->sql_freeresult($result);
set_config('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']);
set_config('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']);
$this->config->set('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']);
$this->config->set('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']);
return false;
}
@ -745,7 +745,7 @@ class fulltext_mysql extends \phpbb\search\base
// destroy too old cached search results
$this->destroy_cache(array());
set_config('search_last_gc', time(), true);
$this->config->set('search_last_gc', time(), false);
}
/**

View File

@ -1425,7 +1425,7 @@ class fulltext_native extends \phpbb\search\base
// carry on ... it's okay ... I know when I'm not wanted boo hoo
if (!$this->config['fulltext_native_load_upd'])
{
set_config('search_last_gc', time(), true);
$this->config->set('search_last_gc', time(), false);
return;
}
@ -1460,7 +1460,7 @@ class fulltext_native extends \phpbb\search\base
// by setting search_last_gc to the new time here we make sure that if a user reloads because the
// following query takes too long, he won't run into it again
set_config('search_last_gc', time(), true);
$this->config->set('search_last_gc', time(), false);
// Delete the matches
$sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . '
@ -1476,7 +1476,7 @@ class fulltext_native extends \phpbb\search\base
$this->destroy_cache(array_unique($destroy_cache_words));
}
set_config('search_last_gc', time(), true);
$this->config->set('search_last_gc', time(), false);
}
/**

View File

@ -746,7 +746,7 @@ class fulltext_postgres extends \phpbb\search\base
// destroy too old cached search results
$this->destroy_cache(array());
set_config('search_last_gc', time(), true);
$this->config->set('search_last_gc', time(), false);
}
/**

View File

@ -140,7 +140,7 @@ class fulltext_sphinx
if(!$this->config['fulltext_sphinx_id'])
{
set_config('fulltext_sphinx_id', unique_id());
$this->config->set('fulltext_sphinx_id', unique_id());
}
$this->id = $this->config['fulltext_sphinx_id'];
$this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main';
@ -211,7 +211,7 @@ class fulltext_sphinx
}
// Move delta to main index each hour
set_config('search_gc', 3600);
$this->config->set('search_gc', 3600);
return false;
}
@ -757,7 +757,7 @@ class fulltext_sphinx
*/
public function tidy($create = false)
{
set_config('search_last_gc', time(), true);
$this->config->set('search_last_gc', time(), false);
}
/**

View File

@ -345,8 +345,8 @@ class session
}
else
{
set_config('limit_load', '0');
set_config('limit_search_load', '0');
$config->set('limit_load', '0');
$config->set('limit_search_load', '0');
}
}
@ -1036,7 +1036,7 @@ class session
{
// Less than 10 users, update gc timer ... else we want gc
// called again to delete other sessions
set_config('session_last_gc', $this->time_now, true);
$config->set('session_last_gc', $this->time_now, false);
if ($config['max_autologin_time'])
{

View File

@ -39,7 +39,6 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$db = $this->db = $this->new_dbal();
$config = $this->config = new \phpbb\config\config(array('cron_lock' => '0'));
set_config(null, null, null, $this->config);
$this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db);
$this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));

View File

@ -32,7 +32,6 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
'load_online_time' => 5,
'search_type' => '\phpbb\search\fulltext_mysql',
));
set_config(false, false, false, $config);
set_config_count(false, false, false, $config);
$cache = new phpbb_mock_null_cache();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();

View File

@ -30,7 +30,6 @@ class phpbb_lock_db_test extends phpbb_database_test_case
$db = $this->db = $this->new_dbal();
$config = $this->config = new \phpbb\config\config(array('rand_seed' => '', 'rand_seed_last_update' => '0'));
set_config(null, null, null, $this->config);
$this->lock = new \phpbb\lock\db('test_lock', $this->config, $this->db);
}

View File

@ -40,8 +40,6 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_content.' . $phpEx);
set_config(false, false, false, $this->config);
$this->container->set('groupposition.legend', new \phpbb\groupposition\legend(
$this->db,
$this->user

View File

@ -70,7 +70,6 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
// Config
$config = new \phpbb\config\config(array('num_topics' => 1,'num_posts' => 1,));
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
$cache = new \phpbb\cache\service(

View File

@ -33,7 +33,6 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
$db = $this->new_dbal();
$config = new \phpbb\config\config(array());
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
$cache = new \phpbb\cache\service(

View File

@ -84,7 +84,6 @@ class phpbb_session_testable_factory
request_var(null, null, null, null, $request);
$config = $this->config = new \phpbb\config\config($this->get_config_data());
set_config(null, null, null, $config);
$db = $dbal;

View File

@ -577,7 +577,7 @@ class phpbb_functional_test_case extends phpbb_test_case
{
require_once(__DIR__ . '/../../phpBB/includes/functions_user.php');
}
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$passwords_manager = $this->get_passwords_manager();

View File

@ -59,7 +59,6 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case
global $config;
$config = $this->config = new \phpbb\config\config(array('nestedset_forum_lock' => 0));
set_config(null, null, null, $this->config);
$this->lock = new \phpbb\lock\db('nestedset_forum_lock', $this->config, $this->db);
$this->set = new \phpbb\tree\nestedset_forum($this->db, $this->lock, 'phpbb_forums');