From: Meik S. <acy...@us...> - 2003-11-30 17:45:16
|
Update of /cvsroot/phpbb/phpBB2 In directory sc8-pr-cvs1:/tmp/cvs-serv24148 Modified Files: posting.php Log Message: speed improvement... slap me for not seeing the user var. ;) Index: posting.php =================================================================== RCS file: /cvsroot/phpbb/phpBB2/posting.php,v retrieving revision 1.310 retrieving revision 1.311 diff -C2 -r1.310 -r1.311 *** posting.php 27 Nov 2003 23:44:59 -0000 1.310 --- posting.php 30 Nov 2003 17:45:13 -0000 1.311 *************** *** 585,612 **** { // Flood check if ($user->data['user_id'] != ANONYMOUS) { ! $sql = 'SELECT user_lastpost_time AS last_post_time ! FROM ' . USERS_TABLE . ' ! WHERE user_id = ' . $user->data['user_id']; } else { - // NOTE: probably faster (to be tested) -- Ashe - // a compound index on (poster_ip, post_time) might help too $sql = 'SELECT post_time AS last_post_time FROM ' . POSTS_TABLE . " WHERE poster_ip = '" . $user->ip . "' AND post_time > " . ($current_time - $config['flood_interval']); ! ! $sql = 'SELECT MAX(post_time) AS last_post_time ! FROM ' . POSTS_TABLE . " ! WHERE poster_ip = '" . $user->ip . "'"; } - $result = $db->sql_query_limit($sql, 1); ! if ($row = $db->sql_fetchrow($result)) { ! if (intval($row['last_post_time']) && ($current_time - intval($row['last_post_time'])) < intval($config['flood_interval'])) { $error[] = $user->lang['FLOOD_ERROR']; --- 585,610 ---- { // Flood check + $last_post_time = 0; + if ($user->data['user_id'] != ANONYMOUS) { ! $last_post_time = $user->data['user_lastpost_time']; } else { $sql = 'SELECT post_time AS last_post_time FROM ' . POSTS_TABLE . " WHERE poster_ip = '" . $user->ip . "' AND post_time > " . ($current_time - $config['flood_interval']); ! $result = $db->sql_query_limit($sql, 1); ! if ($row = $db->sql_fetchrow($result)) ! { ! $last_post_time = $row['last_post_time']; ! } } ! if ($last_post_time) { ! if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval'])) { $error[] = $user->lang['FLOOD_ERROR']; *************** *** 2062,2071 **** } ! // NOTE: Delete topic shadows when made global? If so, we probably need an index on topic_moved_id (Ashe) ! /* if ($make_global) { $db->sql_query('DELETE FROM ' . TOPICS_TABLE . ' WHERE topic_moved_id = ' . $data['topic_id']); ! }*/ // Fulltext parse --- 2060,2069 ---- } ! // Delete topic shadows (if any exist). We do not need a shadow topic for an global announcement ! if ($make_global) { $db->sql_query('DELETE FROM ' . TOPICS_TABLE . ' WHERE topic_moved_id = ' . $data['topic_id']); ! } // Fulltext parse |