Ticket #47599: 47599.diff
| File 47599.diff, 4.9 KB (added by , 7 years ago) |
|---|
-
src/wp-includes/class-wp-network-query.php
213 213 */ 214 214 $network_ids = apply_filters_ref_array( 'networks_pre_query', array( $network_ids, &$this ) ); 215 215 216 if ( null === $network_ids ) { 216 if ( null !== $network_ids ) { 217 $this->networks = $network_ids; 217 218 218 // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.219 $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );219 return $this->networks; 220 } 220 221 221 // Ignore the $fields argument as the queried result will be the same regardless.222 unset( $_args['fields']);222 // $args can include anything. Only use the args defined in the query_var_defaults to compute the key. 223 $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); 223 224 224 $key = md5( serialize( $_args ) );225 $last_changed = wp_cache_get_last_changed( 'networks');225 // Ignore the $fields argument as the queried result will be the same regardless. 226 unset( $_args['fields'] ); 226 227 227 $cache_key = "get_network_ids:$key:$last_changed";228 $cache_value = wp_cache_get( $cache_key,'networks' );228 $key = md5( serialize( $_args ) ); 229 $last_changed = wp_cache_get_last_changed( 'networks' ); 229 230 230 if ( false === $cache_value ) { 231 $network_ids = $this->get_network_ids(); 232 if ( $network_ids ) { 233 $this->set_found_networks(); 234 } 231 $cache_key = "get_network_ids:$key:$last_changed"; 232 $cache_value = wp_cache_get( $cache_key, 'networks' ); 235 233 236 $cache_value = array( 237 'network_ids' => $network_ids, 238 'found_networks' => $this->found_networks, 239 ); 240 wp_cache_add( $cache_key, $cache_value, 'networks' ); 241 } else { 242 $network_ids = $cache_value['network_ids']; 243 $this->found_networks = $cache_value['found_networks']; 234 if ( false === $cache_value ) { 235 $network_ids = $this->get_network_ids(); 236 if ( $network_ids ) { 237 $this->set_found_networks(); 244 238 } 239 240 $cache_value = array( 241 'network_ids' => $network_ids, 242 'found_networks' => $this->found_networks, 243 ); 244 wp_cache_add( $cache_key, $cache_value, 'networks' ); 245 } else { 246 $network_ids = $cache_value['network_ids']; 247 $this->found_networks = $cache_value['found_networks']; 245 248 } 246 249 247 250 if ( $this->found_networks && $this->query_vars['number'] ) { -
src/wp-includes/class-wp-site-query.php
304 304 */ 305 305 $site_ids = apply_filters_ref_array( 'sites_pre_query', array( $site_ids, &$this ) ); 306 306 307 if ( null === $site_ids ) { 307 if ( null !== $site_ids ) { 308 $this->sites = $site_ids; 308 309 309 // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.310 $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );310 return $this->sites; 311 } 311 312 312 // Ignore the $fields argument as the queried result will be the same regardless.313 unset( $_args['fields']);313 // $args can include anything. Only use the args defined in the query_var_defaults to compute the key. 314 $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ); 314 315 315 $key = md5( serialize( $_args ) );316 $last_changed = wp_cache_get_last_changed( 'sites');316 // Ignore the $fields argument as the queried result will be the same regardless. 317 unset( $_args['fields'] ); 317 318 318 $cache_key = "get_sites:$key:$last_changed";319 $cache_value = wp_cache_get( $cache_key,'sites' );319 $key = md5( serialize( $_args ) ); 320 $last_changed = wp_cache_get_last_changed( 'sites' ); 320 321 321 if ( false === $cache_value ) { 322 $site_ids = $this->get_site_ids(); 323 if ( $site_ids ) { 324 $this->set_found_sites(); 325 } 322 $cache_key = "get_sites:$key:$last_changed"; 323 $cache_value = wp_cache_get( $cache_key, 'sites' ); 326 324 327 $cache_value = array( 328 'site_ids' => $site_ids, 329 'found_sites' => $this->found_sites, 330 ); 331 wp_cache_add( $cache_key, $cache_value, 'sites' ); 332 } else { 333 $site_ids = $cache_value['site_ids']; 334 $this->found_sites = $cache_value['found_sites']; 325 if ( false === $cache_value ) { 326 $site_ids = $this->get_site_ids(); 327 if ( $site_ids ) { 328 $this->set_found_sites(); 335 329 } 330 331 $cache_value = array( 332 'site_ids' => $site_ids, 333 'found_sites' => $this->found_sites, 334 ); 335 wp_cache_add( $cache_key, $cache_value, 'sites' ); 336 } else { 337 $site_ids = $cache_value['site_ids']; 338 $this->found_sites = $cache_value['found_sites']; 336 339 } 337 340 338 341 if ( $this->found_sites && $this->query_vars['number'] ) {