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
This commit is contained in:
Sergey Biryukov 2019-12-10 13:47:00 +00:00
parent ee58f3f3d3
commit aa919cd160
2 changed files with 2 additions and 2 deletions

View File

@ -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.

View File

@ -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.