Commit 3a02ee64 authored by Dries's avatar Dries

- Patch #22786 by mathias: now that db_affected_rows() returns the number of...

- Patch #22786 by mathias: now that db_affected_rows() returns the number of rows matched instead of only changed we can get rid of the hacks that worked around this.
parent e5ecab07
......@@ -215,11 +215,7 @@ function search_cron() {
$total = db_result(db_query("SELECT SUM(score) FROM {search_index} WHERE word = '%s'", $word));
db_query("UPDATE {search_total} SET count = %d WHERE word = '%s'", $total, $word);
if (!db_affected_rows()) {
// Note: affected rows does not count matching rows that already had the right value!
$exists = db_result(db_query("SELECT COUNT(*) FROM {search_total} WHERE word = '%s'", $word));
if (!$exists) {
db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %d)", $word, $total);
}
db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %d)", $word, $total);
}
}
// Find words that were deleted from search_index, but are still in
......
......@@ -215,11 +215,7 @@ function search_cron() {
$total = db_result(db_query("SELECT SUM(score) FROM {search_index} WHERE word = '%s'", $word));
db_query("UPDATE {search_total} SET count = %d WHERE word = '%s'", $total, $word);
if (!db_affected_rows()) {
// Note: affected rows does not count matching rows that already had the right value!
$exists = db_result(db_query("SELECT COUNT(*) FROM {search_total} WHERE word = '%s'", $word));
if (!$exists) {
db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %d)", $word, $total);
}
db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %d)", $word, $total);
}
}
// Find words that were deleted from search_index, but are still in
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment