From d7f3c18d17e4be51c18eb3adcbc1492659026757 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 25 Apr 2008 17:59:36 +0000 Subject: - Patch #250729 by R.Muilwijk: performance improvement. --- modules/comment/comment.module | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 05fe9a11e..c618c2ef5 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -582,7 +582,9 @@ 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)); + if (variable_get('comment_' . $node->type, COMMENT_NODE_READ_WRITE) != 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)); + } break; case 'prepare': -- cgit v1.2.3