In `get_page_of_comment()`, use a true `COUNT` query.
This improves memory usage by not compiling a list of comment IDs. See #34057. Built from https://develop.svn.wordpress.org/trunk@34661 git-svn-id: http://core.svn.wordpress.org/trunk@34625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ae60606ff8
commit
90544d66f2
|
@ -879,6 +879,7 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
||||||
'type' => $args['type'],
|
'type' => $args['type'],
|
||||||
'post_id' => $comment->comment_post_ID,
|
'post_id' => $comment->comment_post_ID,
|
||||||
'fields' => 'ids',
|
'fields' => 'ids',
|
||||||
|
'count' => true,
|
||||||
'status' => 'approve',
|
'status' => 'approve',
|
||||||
'date_query' => array(
|
'date_query' => array(
|
||||||
array(
|
array(
|
||||||
|
@ -888,8 +889,8 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$older_comment_ids = get_comments( $comment_args );
|
$comment_query = new WP_Comment_Query();
|
||||||
$older_comment_count = count( $older_comment_ids );
|
$older_comment_count = $comment_query->query( $comment_args );
|
||||||
|
|
||||||
// No older comments? Then it's page #1.
|
// No older comments? Then it's page #1.
|
||||||
if ( 0 == $older_comment_count )
|
if ( 0 == $older_comment_count )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34660';
|
$wp_version = '4.4-alpha-34661';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue