mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Multisite: Don't store max_num_pages
in WP_Network_Query
query cache.
This value can be easily calculated with available data. Props spacedmonkey. Fixes #32504. Built from https://develop.svn.wordpress.org/trunk@38003 git-svn-id: http://core.svn.wordpress.org/trunk@37944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d11c9de613
commit
7b5cd0c021
@ -229,13 +229,15 @@ class WP_Network_Query {
|
|||||||
$cache_value = array(
|
$cache_value = array(
|
||||||
'network_ids' => $network_ids,
|
'network_ids' => $network_ids,
|
||||||
'found_networks' => $this->found_networks,
|
'found_networks' => $this->found_networks,
|
||||||
'max_num_pages' => $this->max_num_pages,
|
|
||||||
);
|
);
|
||||||
wp_cache_add( $cache_key, $cache_value, 'networks' );
|
wp_cache_add( $cache_key, $cache_value, 'networks' );
|
||||||
} else {
|
} else {
|
||||||
$network_ids = $cache_value['network_ids'];
|
$network_ids = $cache_value['network_ids'];
|
||||||
$this->found_networks = $cache_value['found_networks'];
|
$this->found_networks = $cache_value['found_networks'];
|
||||||
$this->max_num_pages = $cache_value['max_num_pages'];
|
}
|
||||||
|
|
||||||
|
if ( $this->found_networks && $this->query_vars['number'] ) {
|
||||||
|
$this->max_num_pages = ceil( $this->found_networks / $this->query_vars['number'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// If querying for a count only, there's nothing more to do.
|
// If querying for a count only, there's nothing more to do.
|
||||||
@ -477,7 +479,6 @@ class WP_Network_Query {
|
|||||||
$found_networks_query = apply_filters( 'found_networks_query', 'SELECT FOUND_ROWS()', $this );
|
$found_networks_query = apply_filters( 'found_networks_query', 'SELECT FOUND_ROWS()', $this );
|
||||||
|
|
||||||
$this->found_networks = (int) $wpdb->get_var( $found_networks_query );
|
$this->found_networks = (int) $wpdb->get_var( $found_networks_query );
|
||||||
$this->max_num_pages = ceil( $this->found_networks / $this->query_vars['number'] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-beta2-38002';
|
$wp_version = '4.6-beta2-38003';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user