Make WordPress Core


Ignore:
Timestamp:
02/12/2010 05:06:43 PM (16 years ago)
Author:
ryan
Message:

Preload commonly loaded site options when running multisite without a persistent cache. Introduce wp_cache_reset() and call it instead of wp_cache_init() when re-initing after the blog ID chanages to avoid throwing out the entire cache. Pass cached site options through the site option filter when fetching.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-load.php

    r13025 r13066  
    7676function get_current_site_name( $current_site ) {
    7777    global $wpdb;
    78     $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', "site-options" );
     78    $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', 'site-options' );
    7979    if ( ! $current_site->site_name ) {
    80         $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
    81         if ( ! $current_site->site_name )
    82             $current_site->site_name = ucfirst( $current_site->domain );
     80        $current_site->site_name = wp_cache_get( $current_site->id . ':site_name', 'site-options' );
     81        if ( ! $current_site->site_name ) {
     82            $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
     83            if ( ! $current_site->site_name )
     84                $current_site->site_name = ucfirst( $current_site->domain );
     85        }
    8386        wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' );
    8487    }
     
    108111            $current_site->cookie_domain = $current_site->domain;
    109112
     113        wp_load_core_site_options($current_site->id);
     114
    110115        return $current_site;
    111116    }
     
    117122    $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site
    118123    if ( 1 == count( $sites ) ) {
     124        wp_load_core_site_options($current_site->id);
    119125        $current_site = $sites[0];
    120126        $path = $current_site->path;
Note: See TracChangeset for help on using the changeset viewer.