WordPress.org

Make WordPress Core

Ticket #11644: 11644.get_blog_option.2.2.diff

File 11644.get_blog_option.2.2.diff, 939 bytes (added by sivel, 4 years ago)

same as above but adds 'noop' as default for get_option

  • wp-includes/ms-functions.php

     
    249249 
    250250        $key = $blog_id."-".$setting."-blog_option"; 
    251251        $value = wp_cache_get( $key, "site-options" ); 
    252         if ( $value == null ) { 
     252 
     253        if ( $value == null && $blog_id == $wpdb->blogid ) { 
     254                $value = get_option( $setting, 'noop' ); 
     255                if ( $value == false ) 
     256                        wp_cache_set( $key, 'falsevalue', 'site-options' ); 
     257                else 
     258                        wp_cache_set( $key, $value, 'site-options' ); 
     259        } elseif ( $value == null && $blog_id != $wpdb->blogid ) { 
    253260                $blog_prefix = $wpdb->get_blog_prefix( $blog_id ); 
    254261                $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$blog_prefix}options WHERE option_name = %s", $setting ) ); 
    255262                if ( is_object( $row ) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values