|
From: Paul S. O. <ps...@us...> - 2001-11-15 21:29:02
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv3305
Modified Files:
posting.php
Log Message:
This removes the looping queries causing the horendous query count ... clutch now fixed, but only with sticky tape
Index: posting.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/posting.php,v
retrieving revision 1.94
retrieving revision 1.95
diff -C2 -r1.94 -r1.95
*** posting.php 2001/11/15 16:35:09 1.94
--- posting.php 2001/11/15 21:28:58 1.95
***************
*** 153,180 ****
$words_removed = 0;
!
for($i = 0; $i < $post_count; $i++)
{
if( ( $rowset[$i]['post_occur_count'] / $row['total_posts'] ) >= $percent )
{
! $sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
! WHERE word_id = " . $rowset[$i]['word_id'];
! $result = $db->sql_query($sql);
! if( !$result )
! {
! message_die(GENERAL_ERROR, "Couldn't delete word list entry", "", __LINE__, __FILE__, $sql);
! }
!
! $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
! WHERE word_id = " . $rowset[$i]['word_id'];
! $result = $db->sql_query($sql);
! if( !$result )
{
! message_die(GENERAL_ERROR, "Couldn't delete word match entry", "", __LINE__, __FILE__, $sql);
}
$words_removed++;
}
}
}
}
--- 153,187 ----
$words_removed = 0;
! $word_id_sql = "";
for($i = 0; $i < $post_count; $i++)
{
if( ( $rowset[$i]['post_occur_count'] / $row['total_posts'] ) >= $percent )
{
! if( $word_id_sql != "" )
{
! $word_id_sql .= ", ";
}
+ $word_id_sql .= $rowset[$i]['word_id'];
$words_removed++;
}
}
+
+ $sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
+ WHERE word_id IN ($word_id_sql)";
+ $result = $db->sql_query($sql);
+ if( !$result )
+ {
+ message_die(GENERAL_ERROR, "Couldn't delete word list entry", "", __LINE__, __FILE__, $sql);
+ }
+
+ $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
+ WHERE word_id IN ($word_id_sql)";
+ $result = $db->sql_query($sql);
+ if( !$result )
+ {
+ message_die(GENERAL_ERROR, "Couldn't delete word match entry", "", __LINE__, __FILE__, $sql);
+ }
+
}
}
***************
*** 282,297 ****
$rowset = $db->sql_fetchrowset($result);
for($i = 0; $i < $post_count; $i++)
{
if( $rowset[$i]['post_occur_count'] == 1 )
{
! $sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
! WHERE word_id = " . $rowset[$i]['word_id'];
! $result = $db->sql_query($sql);
! if( !$result )
{
! message_die(GENERAL_ERROR, "Couldn't delete word list entry", "", __LINE__, __FILE__, $sql);
}
}
}
}
--- 289,311 ----
$rowset = $db->sql_fetchrowset($result);
+ $word_id_sql = "";
for($i = 0; $i < $post_count; $i++)
{
if( $rowset[$i]['post_occur_count'] == 1 )
{
! if( $word_id_sql != "" )
{
! $word_id_sql .= ", ";
}
+ $word_id_sql .= $rowset[$i]['word_id'];
}
+ }
+
+ $sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
+ WHERE word_id IN ($word_id_sql)";
+ $result = $db->sql_query($sql);
+ if( !$result )
+ {
+ message_die(GENERAL_ERROR, "Couldn't delete word list entry", "", __LINE__, __FILE__, $sql);
}
}
|