Multisite: Don't store `max_num_pages` in `WP_Site_Query` query cache.
This value can be easily calculated with available data. Props spacedmonkey. Fixes #35791. Built from https://develop.svn.wordpress.org/trunk@38002 git-svn-id: http://core.svn.wordpress.org/trunk@37943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c6d5f78241
commit
d11c9de613
|
@ -265,13 +265,15 @@ class WP_Site_Query {
|
|||
$cache_value = array(
|
||||
'site_ids' => $site_ids,
|
||||
'found_sites' => $this->found_sites,
|
||||
'max_num_pages' => $this->max_num_pages,
|
||||
);
|
||||
wp_cache_add( $cache_key, $cache_value, 'sites' );
|
||||
} else {
|
||||
$site_ids = $cache_value['site_ids'];
|
||||
$this->found_sites = $cache_value['found_sites'];
|
||||
$this->max_num_pages = $cache_value['max_num_pages'];
|
||||
}
|
||||
|
||||
if ( $this->found_sites && $this->query_vars['number'] ) {
|
||||
$this->max_num_pages = ceil( $this->found_sites / $this->query_vars['number'] );
|
||||
}
|
||||
|
||||
// If querying for a count only, there's nothing more to do.
|
||||
|
@ -588,7 +590,6 @@ class WP_Site_Query {
|
|||
$found_sites_query = apply_filters( 'found_sites_query', 'SELECT FOUND_ROWS()', $this );
|
||||
|
||||
$this->found_sites = (int) $wpdb->get_var( $found_sites_query );
|
||||
$this->max_num_pages = ceil( $this->found_sites / $this->query_vars['number'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-beta2-38001';
|
||||
$wp_version = '4.6-beta2-38002';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue