Changeset 53097
- Timestamp:
- 04/07/2022 05:44:34 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-site-query.php
r52977 r53097 346 346 $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); 347 347 348 // Ignore the $fields argument as the queried result will be the same regardless.349 unset( $_args['fields'] );348 // Ignore the $fields, $update_site_cache, $update_site_meta_cache argument as the queried result will be the same regardless. 349 unset( $_args['fields'], $_args['update_site_cache'], $_args['update_site_meta_cache'] ); 350 350 351 351 $key = md5( serialize( $_args ) ); -
trunk/tests/phpunit/tests/multisite/wpSiteQuery.php
r51869 r53097 850 850 ); 851 851 852 $number_of_queries = $wpdb->num_queries;852 $number_of_queries = get_num_queries(); 853 853 854 854 $query_2 = $q->query( … … 862 862 ); 863 863 $this->assertSame( $number_of_queries + 1, $wpdb->num_queries ); 864 } 865 866 /** 867 * @ticket 55462 868 */ 869 public function test_wp_site_query_cache_with_same_fields_same_cache_fields() { 870 $q = new WP_Site_Query(); 871 872 $query_1 = $q->query( 873 array( 874 'fields' => 'ids', 875 'network_id' => self::$network_ids['wordpress.org/'], 876 'number' => 3, 877 'order' => 'ASC', 878 'update_site_cache' => true, 879 'update_site_meta_cache' => true, 880 ) 881 ); 882 883 $number_of_queries = get_num_queries(); 884 885 $query_2 = $q->query( 886 array( 887 'fields' => 'ids', 888 'network_id' => self::$network_ids['wordpress.org/'], 889 'number' => 3, 890 'order' => 'ASC', 891 'update_site_cache' => true, 892 'update_site_meta_cache' => true, 893 ) 894 ); 895 $this->assertSame( $number_of_queries, get_num_queries() ); 896 } 897 898 /** 899 * @ticket 55462 900 */ 901 public function test_wp_site_query_cache_with_same_fields_different_cache_fields() { 902 $q = new WP_Site_Query(); 903 904 $query_1 = $q->query( 905 array( 906 'fields' => 'ids', 907 'network_id' => self::$network_ids['wordpress.org/'], 908 'number' => 3, 909 'order' => 'ASC', 910 'update_site_cache' => true, 911 'update_site_meta_cache' => true, 912 ) 913 ); 914 915 $number_of_queries = get_num_queries(); 916 917 $query_2 = $q->query( 918 array( 919 'fields' => 'ids', 920 'network_id' => self::$network_ids['wordpress.org/'], 921 'number' => 3, 922 'order' => 'ASC', 923 'update_site_cache' => false, 924 'update_site_meta_cache' => false, 925 ) 926 ); 927 $this->assertSame( $number_of_queries, get_num_queries() ); 864 928 } 865 929
Note: See TracChangeset
for help on using the changeset viewer.