This removes the looping queries causing the horendous query count ... clutch now fixed, but only with sticky tape

git-svn-id: file:///svn/phpbb/trunk@1323 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-11-15 21:28:58 +00:00
parent 0749e9ca6f
commit 6cbe3f48d8

View file

@ -152,13 +152,23 @@ function remove_common($percent, $word_id_list = array())
$row = $db->sql_fetchrow($result);
$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 = " . $rowset[$i]['word_id'];
WHERE word_id IN ($word_id_sql)";
$result = $db->sql_query($sql);
if( !$result )
{
@ -166,16 +176,13 @@ function remove_common($percent, $word_id_list = array())
}
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE word_id = " . $rowset[$i]['word_id'];
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);
}
$words_removed++;
}
}
}
}
@ -281,20 +288,27 @@ function remove_old_words($post_id)
{
$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 = " . $rowset[$i]['word_id'];
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 post_id = $post_id";