WordPress.org

Make WordPress Core

Changeset 38003


Ignore:
Timestamp:
07/07/2016 03:51:58 PM (3 years ago)
Author:
jeremyfelt
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-network-query.php

    r37894 r38003  
    230230                'network_ids' => $network_ids,
    231231                'found_networks' => $this->found_networks,
    232                 'max_num_pages' => $this->max_num_pages,
    233232            );
    234233            wp_cache_add( $cache_key, $cache_value, 'networks' );
     
    236235            $network_ids = $cache_value['network_ids'];
    237236            $this->found_networks = $cache_value['found_networks'];
    238             $this->max_num_pages = $cache_value['max_num_pages'];
     237        }
     238
     239        if ( $this->found_networks && $this->query_vars['number'] ) {
     240            $this->max_num_pages = ceil( $this->found_networks / $this->query_vars['number'] );
    239241        }
    240242
     
    478480
    479481            $this->found_networks = (int) $wpdb->get_var( $found_networks_query );
    480             $this->max_num_pages = ceil( $this->found_networks / $this->query_vars['number'] );
    481482        }
    482483    }
Note: See TracChangeset for help on using the changeset viewer.