Changeset 56513
- Timestamp:
- 09/05/2023 12:21:27 PM (13 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r56434 r56513 3272 3272 3273 3273 if ( null === $this->posts ) { 3274 $split_the_query = ( $old_request == $this->request && "{$wpdb->posts}.*" === $fields && ! empty( $limits ) && $q['posts_per_page'] < 500 ); 3274 $split_the_query = ( 3275 $old_request == $this->request 3276 && "{$wpdb->posts}.*" === $fields 3277 && ( 3278 wp_using_ext_object_cache() 3279 || ( ! empty( $limits ) && $q['posts_per_page'] < 500 ) 3280 ) 3281 ); 3275 3282 3276 3283 /** -
trunk/tests/phpunit/tests/post/nav-menu.php
r55979 r56513 343 343 344 344 $start_num_queries = get_num_queries(); 345 wp_get_nav_menu_items( $this->menu_id );345 wp_get_nav_menu_items( $this->menu_id, array( 'nopaging' => false ) ); 346 346 $queries_made = get_num_queries() - $start_num_queries; 347 $this->assertSame( 6, $queries_made, 'Only does 6database queries when running wp_get_nav_menu_items.' );347 $this->assertSame( 7, $queries_made, 'Only does 7 database queries when running wp_get_nav_menu_items.' ); 348 348 349 349 $args = $action->get_args(); 350 350 $this->assertSameSets( $menu_nav_ids, $args[0][1], '_prime_post_caches() was not executed.' ); 351 $this->assertSameSets( $post_ids, $args[ 1][1], '_prime_post_caches() was not executed.' );351 $this->assertSameSets( $post_ids, $args[2][1], '_prime_post_caches() was not executed.' ); 352 352 } 353 353 … … 384 384 385 385 $start_num_queries = get_num_queries(); 386 wp_get_nav_menu_items( $this->menu_id );386 wp_get_nav_menu_items( $this->menu_id, array( 'nopaging' => false ) ); 387 387 get_term_meta( $term_ids[0] ); 388 388 $queries_made = get_num_queries() - $start_num_queries; 389 $this->assertSame( 6, $queries_made, 'Only does 6database queries when running wp_get_nav_menu_items.' );389 $this->assertSame( 7, $queries_made, 'Only does 7 database queries when running wp_get_nav_menu_items.' ); 390 390 391 391 $args = $action_terms->get_args(); -
trunk/tests/phpunit/tests/post/query.php
r55745 r56513 776 776 $this->assertIsInt( $q->found_posts ); 777 777 } 778 779 /** 780 * @ticket 57296 781 * @covers WP_Query::get_posts 782 */ 783 public function test_split_the_query_object_cache() { 784 $filter = new MockAction(); 785 add_filter( 'split_the_query', array( $filter, 'filter' ) ); 786 787 $q = new WP_Query( 788 array( 789 'posts_per_page' => 501, 790 ) 791 ); 792 793 $this->assertSame( (bool) wp_using_ext_object_cache(), $filter->get_args()[0][0] ); 794 } 778 795 }
Note: See TracChangeset
for help on using the changeset viewer.