aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-11-15 21:28:58 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-11-15 21:28:58 +0000
commit6cbe3f48d822141aa3b8aadbdf8f6c1ae2936df2 (patch)
tree412ae938af5cc8d2c15a8589c7bcda2e12e6f90f
parent0749e9ca6fd747c3f9c2bf6e5a31826204633b0e (diff)
downloadforums-6cbe3f48d822141aa3b8aadbdf8f6c1ae2936df2.tar
forums-6cbe3f48d822141aa3b8aadbdf8f6c1ae2936df2.tar.gz
forums-6cbe3f48d822141aa3b8aadbdf8f6c1ae2936df2.tar.bz2
forums-6cbe3f48d822141aa3b8aadbdf8f6c1ae2936df2.tar.xz
forums-6cbe3f48d822141aa3b8aadbdf8f6c1ae2936df2.zip
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
-rw-r--r--phpBB/posting.php52
1 files changed, 33 insertions, 19 deletions
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 375232da0c..8d7c9815d1 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -152,30 +152,37 @@ 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 )
{
- $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 )
+ if( $word_id_sql != "" )
{
- message_die(GENERAL_ERROR, "Couldn't delete word match entry", "", __LINE__, __FILE__, $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);
+ }
+
}
}
@@ -281,19 +288,26 @@ 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 )
{
- $sql = "DELETE FROM " . SEARCH_WORD_TABLE . "
- WHERE word_id = " . $rowset[$i]['word_id'];
- $result = $db->sql_query($sql);
- if( !$result )
+ if( $word_id_sql != "" )
{
- 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 . "