WordPress.org

Make WordPress Core

Ticket #14461: fix-remove-current-site-name-duplicache.diff

File fix-remove-current-site-name-duplicache.diff, 1.4 KB (added by benward, 4 years ago)

Patch to remove get/set of ':current_site_name' cache key and just use ':site_name' instead.

  • wordpress/wp-includes/ms-load.php

     
    8787 */ 
    8888function get_current_site_name( $current_site ) { 
    8989        global $wpdb; 
    90         $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', 'site-options' ); 
     90 
     91        $current_site->site_name = wp_cache_get( $current_site->id . ':site_name', 'site-options' ); 
    9192        if ( ! $current_site->site_name ) { 
    92                 $current_site->site_name = wp_cache_get( $current_site->id . ':site_name', 'site-options' ); 
    93                 if ( ! $current_site->site_name ) { 
    94                         $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 ) ); 
    95                         if ( ! $current_site->site_name ) 
    96                                 $current_site->site_name = ucfirst( $current_site->domain ); 
    97                 } 
    98                 wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' ); 
     93                $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 ) ); 
     94                if ( ! $current_site->site_name ) 
     95                        $current_site->site_name = ucfirst( $current_site->domain ); 
    9996        } 
     97        wp_cache_set( $current_site->id . ':site_name', $current_site->site_name, 'site-options' ); 
     98 
    10099        return $current_site; 
    101100} 
    102101