Comments: Add 'parent__in' and 'parent__not_in' to query var defaults.
Query var defaults are used to calculate a cache key. The fact that these params were not listed among the defaults was causing cache keys to be insufficiently specific. Props danielbachhuber. Fixes #35677. git-svn-id: https://develop.svn.wordpress.org/trunk@36479 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cdf27d383d
commit
3ec4faf6e3
@ -273,6 +273,8 @@ class WP_Comment_Query {
|
|||||||
'orderby' => '',
|
'orderby' => '',
|
||||||
'order' => 'DESC',
|
'order' => 'DESC',
|
||||||
'parent' => '',
|
'parent' => '',
|
||||||
|
'parent__in' => '',
|
||||||
|
'parent__not_in' => '',
|
||||||
'post_author__in' => '',
|
'post_author__in' => '',
|
||||||
'post_author__not_in' => '',
|
'post_author__not_in' => '',
|
||||||
'post_ID' => '',
|
'post_ID' => '',
|
||||||
|
@ -1864,6 +1864,44 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
|||||||
$this->assertSame( $num_queries, $wpdb->num_queries );
|
$this->assertSame( $num_queries, $wpdb->num_queries );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ticket 35677
|
||||||
|
*/
|
||||||
|
public function test_cache_should_be_sensitive_to_parent__in() {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$q1 = new WP_Comment_Query( array(
|
||||||
|
'parent__in' => array( 1, 2, 3 ),
|
||||||
|
) );
|
||||||
|
|
||||||
|
$num_queries = $wpdb->num_queries;
|
||||||
|
|
||||||
|
$q2 = new WP_Comment_Query( array(
|
||||||
|
'parent__in' => array( 4, 5, 6 ),
|
||||||
|
) );
|
||||||
|
|
||||||
|
$this->assertNotEquals( $num_queries, $wpdb->num_queries );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ticket 35677
|
||||||
|
*/
|
||||||
|
public function test_cache_should_be_sensitive_to_parent__not_in() {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$q1 = new WP_Comment_Query( array(
|
||||||
|
'parent__not_in' => array( 1, 2, 3 ),
|
||||||
|
) );
|
||||||
|
|
||||||
|
$num_queries = $wpdb->num_queries;
|
||||||
|
|
||||||
|
$q2 = new WP_Comment_Query( array(
|
||||||
|
'parent__not_in' => array( 4, 5, 6 ),
|
||||||
|
) );
|
||||||
|
|
||||||
|
$this->assertNotEquals( $num_queries, $wpdb->num_queries );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ticket 32762
|
* @ticket 32762
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user