WordPress.org

Make WordPress Core

Changeset 38002


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

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.

File:
1 edited

Legend:

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

    r37875 r38002  
    266266                'site_ids' => $site_ids,
    267267                'found_sites' => $this->found_sites,
    268                 'max_num_pages' => $this->max_num_pages,
    269268            );
    270269            wp_cache_add( $cache_key, $cache_value, 'sites' );
     
    272271            $site_ids = $cache_value['site_ids'];
    273272            $this->found_sites = $cache_value['found_sites'];
    274             $this->max_num_pages = $cache_value['max_num_pages'];
     273        }
     274
     275        if ( $this->found_sites && $this->query_vars['number'] ) {
     276            $this->max_num_pages = ceil( $this->found_sites / $this->query_vars['number'] );
    275277        }
    276278
     
    589591
    590592            $this->found_sites = (int) $wpdb->get_var( $found_sites_query );
    591             $this->max_num_pages = ceil( $this->found_sites / $this->query_vars['number'] );
    592593        }
    593594    }
Note: See TracChangeset for help on using the changeset viewer.