From aa919cd160edb239f8b0665361cee1c7aa0761ab Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 10 Dec 2019 13:47:00 +0000 Subject: [PATCH] Comments: Optimize the query for pending comments count in `wp_notify_moderator()` for better performance on large tables. Props sgoen. Fixes #48514. Built from https://develop.svn.wordpress.org/trunk@46878 git-svn-id: http://core.svn.wordpress.org/trunk@46678 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/pluggable.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 3b81242f4d..5edef2d0c5 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1739,7 +1739,7 @@ if ( ! function_exists( 'wp_notify_moderator' ) ) : $comment_author_domain = gethostbyaddr( $comment->comment_author_IP ); } - $comments_waiting = $wpdb->get_var( "SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'" ); + $comments_waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" ); // The blogname option is escaped with esc_html on the way into the database in sanitize_option // we want to reverse this for the plain text arena of emails. diff --git a/wp-includes/version.php b/wp-includes/version.php index 8ba4f065dc..7730b1bb1c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-46874'; +$wp_version = '5.4-alpha-46878'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.