summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-06-14 16:02:50 +0000
committerDries Buytaert <dries@buytaert.net>2008-06-14 16:02:50 +0000
commitcf42d0c25a7b3e3fb990e39cc449b10a8b980d21 (patch)
tree9eabda532337716f03d7802163d69a8b9159c52a /modules/comment/comment.module
parenta1537c3e287090609c0392b620f6c05e345c17d8 (diff)
downloadbrdo-cf42d0c25a7b3e3fb990e39cc449b10a8b980d21.tar.gz
brdo-cf42d0c25a7b3e3fb990e39cc449b10a8b980d21.tar.bz2
- Patch #250729 by R.Muilwijk: removed unnecessary SQL query.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index ecb73af92..56000102c 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -589,8 +589,10 @@ function comment_form_alter(&$form, $form_state, $form_id) {
function comment_nodeapi(&$node, $op, $arg = 0) {
switch ($op) {
case 'load':
- return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid));
- break;
+ if ($node->comment != COMMENT_NODE_DISABLED) {
+ return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid));
+ }
+ return array('last_comment_timestamp' => $node->created, 'last_comment_name' => '', 'commenet_count' => 0);
case 'prepare':
if (!isset($node->comment)) {