mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
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:
parent
0749e9ca6f
commit
6cbe3f48d8
1 changed files with 33 additions and 19 deletions
|
@ -152,30 +152,37 @@ function remove_common($percent, $word_id_list = array())
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
|
||||||
$words_removed = 0;
|
$words_removed = 0;
|
||||||
|
$word_id_sql = "";
|
||||||
for($i = 0; $i < $post_count; $i++)
|
for($i = 0; $i < $post_count; $i++)
|
||||||
{
|
{
|
||||||
if( ( $rowset[$i]['post_occur_count'] / $row['total_posts'] ) >= $percent )
|
if( ( $rowset[$i]['post_occur_count'] / $row['total_posts'] ) >= $percent )
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
|
if( $word_id_sql != "" )
|
||||||
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);
|
$word_id_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);
|
|
||||||
}
|
}
|
||||||
|
$word_id_sql .= $rowset[$i]['word_id'];
|
||||||
|
|
||||||
$words_removed++;
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,19 +288,26 @@ function remove_old_words($post_id)
|
||||||
{
|
{
|
||||||
$rowset = $db->sql_fetchrowset($result);
|
$rowset = $db->sql_fetchrowset($result);
|
||||||
|
|
||||||
|
$word_id_sql = "";
|
||||||
for($i = 0; $i < $post_count; $i++)
|
for($i = 0; $i < $post_count; $i++)
|
||||||
{
|
{
|
||||||
if( $rowset[$i]['post_occur_count'] == 1 )
|
if( $rowset[$i]['post_occur_count'] == 1 )
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
|
if( $word_id_sql != "" )
|
||||||
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);
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
|
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
|
||||||
|
|
Loading…
Add table
Reference in a new issue