mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 15:45:34 +02:00
Changed code so it stores total users in config table to remove a slightly costly query
git-svn-id: file:///svn/phpbb/trunk@2549 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
559dff21b7
commit
52c0d86c95
@ -60,7 +60,10 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date
|
|||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.myserver.tld');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', 'www.myserver.tld');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '80');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '/phpBB2/');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.1.0 [20020421]');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('newest_user_id', 2);
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('newest_username', 'Admin');
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('num_users', 1);
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '.1.0 [20020430]');
|
||||||
|
|
||||||
|
|
||||||
# -- Categories
|
# -- Categories
|
||||||
|
@ -517,6 +517,15 @@ if ( isset($HTTP_POST_VARS['submit']) )
|
|||||||
message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
|
message_die(GENERAL_ERROR, 'Could not insert data into user_group table', '', __LINE__, __FILE__, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user_update_id = "UPDATE " . CONFIG_TABLE . " SET config_value = $user_id WHERE config_name = 'newest_user_id'";
|
||||||
|
$user_update_name = "UPDATE " . CONFIG_TABLE . " SET config_value = '$username' WHERE config_name = 'newest_username'";
|
||||||
|
$user_update_count = "UPDATE " . CONFIG_TABLE . " SET config_value = " . ($board_config['num_users'] + 1) . " WHERE config_name = 'num_users'";
|
||||||
|
|
||||||
|
if( !$db->sql_query($user_update_id) || !$db->sql_query($user_update_name) || !$db->sql_query($user_update_count) )
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, 'Could not update user count information!', '', __LINE__, __FILE__);
|
||||||
|
}
|
||||||
|
|
||||||
if ( $coppa )
|
if ( $coppa )
|
||||||
{
|
{
|
||||||
$message = $lang['COPPA'];
|
$message = $lang['COPPA'];
|
||||||
|
@ -75,10 +75,13 @@ $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f'
|
|||||||
// removing them
|
// removing them
|
||||||
//
|
//
|
||||||
$total_posts = get_db_stat('postcount');
|
$total_posts = get_db_stat('postcount');
|
||||||
$total_users = get_db_stat('usercount');
|
//$total_users = get_db_stat('usercount');
|
||||||
$newest_userdata = get_db_stat('newestuser');
|
//$newest_userdata = get_db_stat('newestuser');
|
||||||
$newest_user = $newest_userdata['username'];
|
//$newest_user = $newest_userdata['username'];
|
||||||
$newest_uid = $newest_userdata['user_id'];
|
//$newest_uid = $newest_userdata['user_id'];
|
||||||
|
$total_users = $board_config['num_users'];
|
||||||
|
$newest_user = $board_config['newest_username'];
|
||||||
|
$newest_uid = $board_config['newest_user_id'];
|
||||||
|
|
||||||
if( $total_posts == 0 )
|
if( $total_posts == 0 )
|
||||||
{
|
{
|
||||||
|
@ -841,6 +841,16 @@ else
|
|||||||
$error .= "Could not update Board info :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />";
|
$error .= "Could not update Board info :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE " . $table_prefix . "config
|
||||||
|
SET config_value = '" . $admin_name . "'
|
||||||
|
WHERE config_name = 'newest_username'";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
if( !$result )
|
||||||
|
{
|
||||||
|
$error .= "Could not update Board info :: " . $sql . " :: " . __LINE__ . " :: " . __FILE__ . "<br /><br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$admin_pass_md5 = ( $confirm && $userdata['user_level'] == ADMIN ) ? $admin_pass1 : md5($admin_pass1);
|
$admin_pass_md5 = ( $confirm && $userdata['user_level'] == ADMIN ) ? $admin_pass1 : md5($admin_pass1);
|
||||||
|
|
||||||
|
@ -59,7 +59,34 @@ if ( $row = $db->sql_fetchrow($result) )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case '.1.0 [20020421]':
|
||||||
|
$user_data_sql = "SELECT COUNT(user_id) AS total_users, MAX(user_id) AS newest_user_id FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS;
|
||||||
|
if($result = $db->sql_query($user_data_sql))
|
||||||
|
{
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$user_count = $row['total_users'];
|
||||||
|
$newest_user_id = $row['newest_user_id'];
|
||||||
|
|
||||||
|
$username_sql = "SELECT username FROM " . USERS_TABLE . " WHERE user_id = $newest_user_id";
|
||||||
|
if(!$result = $db->sql_query($username_sql))
|
||||||
|
{
|
||||||
|
die('Could not get username to update to [20020430]');
|
||||||
|
}
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$newest_username = $row['username'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
die('Could not get user count for update to [20020430]');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
||||||
|
VALUES ('newest_user_id', $newest_user_id)";
|
||||||
|
$sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
||||||
|
VALUES ('newest_username', '$newest_username')";
|
||||||
|
$sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
||||||
|
VALUES ('num_users', $user_count)";
|
||||||
|
break;
|
||||||
default;
|
default;
|
||||||
echo 'No updates made<br /><br />';
|
echo 'No updates made<br /><br />';
|
||||||
}
|
}
|
||||||
@ -77,7 +104,7 @@ if ( $row = $db->sql_fetchrow($result) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "UPDATE " . CONFIG_TABLE . "
|
$sql = "UPDATE " . CONFIG_TABLE . "
|
||||||
SET config_value = '.1.0 [20020421]'
|
SET config_value = '.1.0 [20020430]'
|
||||||
WHERE config_name = 'version'";
|
WHERE config_name = 'version'";
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
if ( !($result = $db->sql_query($sql)) )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user