diff options
Diffstat (limited to 'modules/node')
-rw-r--r-- | modules/node/node.module | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index 30fc7c4ab..672b3bdb1 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1546,16 +1546,17 @@ function node_update_index() { $last = variable_get('node_cron_last', 0); $limit = (int)variable_get('search_cron_limit', 100); - $result = db_query_range('SELECT n.nid FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND n.moderate = 0 AND (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d) ORDER BY GREATEST(n.created, n.changed, c.last_comment_timestamp) ASC', $last, $last, $last, 0, $limit); + $result = db_query_range('SELECT n.nid, c.last_comment_timestamp FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND n.moderate = 0 AND (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d) ORDER BY GREATEST(n.created, n.changed, c.last_comment_timestamp) ASC', $last, $last, $last, 0, $limit); while ($node = db_fetch_object($result)) { + $last_comment = $node->last_comment_timestamp; $node = node_load(array('nid' => $node->nid)); // We update this variable per node in case cron times out, or if the node // cannot be indexed (PHP nodes which call drupal_goto, for example). // In rare cases this can mean a node is only partially indexed, but the // chances of this happening are very small. - variable_set('node_cron_last', max($node->changed, $node->created)); + variable_set('node_cron_last', max($last_comment, max($node->changed, $node->created))); if (node_hook($node, 'view')) { node_invoke($node, 'view', false, false); |