summaryrefslogtreecommitdiffstats
path: root/wp-includes/comment.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-12-11 11:45:03 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-12-11 11:45:03 +0000
commit040b8591582940de99442bb1de04afdf9d3daf59 (patch)
treeceaa054562fa6089c307b48fc30e963eee357e73 /wp-includes/comment.php
parent91725f574d4fa83b30d8d7c2794e9f078628e6da (diff)
downloadwordpress-mu-040b8591582940de99442bb1de04afdf9d3daf59.tar.gz
wordpress-mu-040b8591582940de99442bb1de04afdf9d3daf59.tar.xz
wordpress-mu-040b8591582940de99442bb1de04afdf9d3daf59.zip
WP Merge to rev 4640
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@823 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/comment.php')
-rw-r--r--wp-includes/comment.php26
1 files changed, 15 insertions, 11 deletions
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index e48214a..a7bf344 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -432,18 +432,13 @@ function wp_set_comment_status($comment_id, $comment_status) {
return false;
}
- if ( $wpdb->query($query) ) {
- do_action('wp_set_comment_status', $comment_id, $comment_status);
-
- $comment = get_comment($comment_id);
- $comment_post_ID = $comment->comment_post_ID;
- $c = $wpdb->get_row("SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'");
- if ( is_object($c) )
- $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'");
- return true;
- } else {
+ if ( !$wpdb->query($query) )
return false;
- }
+
+ do_action('wp_set_comment_status', $comment_id, $comment_status);
+ $comment = get_comment($comment_id);
+ wp_update_comment_count($comment->comment_post_ID);
+ return true;
}
@@ -492,6 +487,15 @@ function wp_update_comment_count($post_id) {
$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'");
$wpdb->query("UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$post_id'");
$comment_count_cache[$post_id] = $count;
+
+ $post = get_post($post_id);
+ if ( 'page' == $post->post_type )
+ clean_page_cache( $post_id );
+ else
+ clean_post_cache( $post_id );
+
+ do_action('edit_post', $post_id);
+
return true;
}