Issue #1715402 by mikeryan: Fixed Poor performance of _forum_update_forum_index() when passed a non-forum node.

merge-requests/26/head
webchick 2012-08-18 14:05:41 +02:00
parent feac3940c3
commit a967540ff1
1 changed files with 1 additions and 1 deletions

View File

@ -1328,7 +1328,7 @@ function _forum_get_topic_order($sortby) {
* The ID of the node to update.
*/
function _forum_update_forum_index($nid) {
$count = db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid AND status = :status', array(
$count = db_query('SELECT COUNT(cid) FROM {comment} c INNER JOIN {forum_index} i ON c.nid = i.nid WHERE c.nid = :nid AND c.status = :status', array(
':nid' => $nid,
':status' => COMMENT_PUBLISHED,
))->fetchField();