|
From: James A. <th...@us...> - 2002-04-30 17:56:53
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv3746
Modified Files:
index.php install.php update_script.php
Log Message:
Changed code so it stores total users in config table to remove a slightly costly query
Index: index.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/index.php,v
retrieving revision 1.99
retrieving revision 1.100
diff -C2 -r1.99 -r1.100
*** index.php 31 Mar 2002 13:58:01 -0000 1.99
--- index.php 30 Apr 2002 17:56:50 -0000 1.100
***************
*** 76,83 ****
//
$total_posts = get_db_stat('postcount');
! $total_users = get_db_stat('usercount');
! $newest_userdata = get_db_stat('newestuser');
! $newest_user = $newest_userdata['username'];
! $newest_uid = $newest_userdata['user_id'];
if( $total_posts == 0 )
--- 76,86 ----
//
$total_posts = get_db_stat('postcount');
! //$total_users = get_db_stat('usercount');
! //$newest_userdata = get_db_stat('newestuser');
! //$newest_user = $newest_userdata['username'];
! //$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 )
Index: install.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/install.php,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** install.php 22 Mar 2002 14:30:05 -0000 1.41
--- install.php 30 Apr 2002 17:56:50 -0000 1.42
***************
*** 841,845 ****
--- 841,855 ----
$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);
Index: update_script.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/update_script.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** update_script.php 20 Apr 2002 23:45:02 -0000 1.5
--- update_script.php 30 Apr 2002 17:56:50 -0000 1.6
***************
*** 60,64 ****
}
break;
!
default;
echo 'No updates made<br /><br />';
--- 60,91 ----
}
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;
echo 'No updates made<br /><br />';
***************
*** 78,82 ****
$sql = "UPDATE " . CONFIG_TABLE . "
! SET config_value = '.1.0 [20020421]'
WHERE config_name = 'version'";
if ( !($result = $db->sql_query($sql)) )
--- 105,109 ----
$sql = "UPDATE " . CONFIG_TABLE . "
! SET config_value = '.1.0 [20020430]'
WHERE config_name = 'version'";
if ( !($result = $db->sql_query($sql)) )
|