From 69e3a390b2be8f56c07e755a94d92925235a52bb Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 15 Sep 2015 01:47:25 +0000 Subject: [PATCH] In `_wp_ajax_delete_comment_response()`, read the new `'all'` prop returned by `get_comment_count()` via `wp_count_comments()` when setting `$total`. `'all'` doesn't include `spam` in its count. Updates unit tests. Props dipesh.kakadiya. Fixes #32362. Built from https://develop.svn.wordpress.org/trunk@34161 git-svn-id: http://core.svn.wordpress.org/trunk@34129 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 3 ++- wp-includes/comment-functions.php | 3 +++ wp-includes/version.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index fbbd402628..26a6bf9b23 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -371,7 +371,8 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { // Only do the expensive stuff on a page-break, and about 1 other time per page if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) { $post_id = 0; - $status = 'total_comments'; // What type of comment count are we looking for? + // What type of comment count are we looking for? + $status = 'all'; $parsed = parse_url( $url ); if ( isset( $parsed['query'] ) ) { parse_str( $parsed['query'], $query_vars ); diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 4b680c8194..7635975267 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -362,6 +362,7 @@ function get_comment_count( $post_id = 0 ) { 'trash' => 0, 'post-trashed' => 0, 'total_comments' => 0, + 'all' => 0, ); foreach ( $totals as $row ) { @@ -379,10 +380,12 @@ function get_comment_count( $post_id = 0 ) { case '1': $comment_count['approved'] = $row['total']; $comment_count['total_comments'] += $row['total']; + $comment_count['all'] += $row['total']; break; case '0': $comment_count['awaiting_moderation'] = $row['total']; $comment_count['total_comments'] += $row['total']; + $comment_count['all'] += $row['total']; break; default: break; diff --git a/wp-includes/version.php b/wp-includes/version.php index 3c8d0d3b4e..f5442d7400 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34160'; +$wp_version = '4.4-alpha-34161'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.