Commit 6183f3a9 authored by Dave Reid's avatar Dave Reid
Browse files

#928698 by Dave Reid: Degrade gracefully when counting node timestamps if...

#928698 by Dave Reid: Degrade gracefully when counting node timestamps if comment module is not enabled.
parent 59c002d0
......@@ -156,7 +156,11 @@ function xmlsitemap_node_get_timestamps(stdClass $node) {
static $timestamps = array();
if (!isset($timestamps[$node->nid])) {
$timestamps[$node->nid] = db_query("SELECT c.created FROM {comment} c WHERE c.nid = :nid AND c.status = :status UNION ALL SELECT nr.timestamp FROM {node_revision} nr WHERE nr.nid = :nid2", array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED, ':nid2' => $node->nid))->fetchCol();
$timestamps[$node->nid] = db_query("SELECT nr.timestamp FROM {node_revision} nr WHERE nr.nid = :nid", array(':nid' => $node->nid))->fetchCol();
if (module_exists('comment')) {
$comment_timestamps = db_query("SELECT c.created FROM {comment} c WHERE c.nid = :nid AND c.status = :status", array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED))->fetchCol();
$timestamps[$node->nid] = array_merge($timestamps[$node->nid], $comment_timestamps);
}
}
return $timestamps[$node->nid];
......
Supports Markdown
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