use object cache on get_blog_option on current blog, props sivel, See #11644
git-svn-id: http://svn.automattic.com/wordpress/trunk@13116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
29a9729ccf
commit
976c058970
|
@ -250,6 +250,16 @@ function get_blog_option( $blog_id, $setting, $default = false ) {
|
|||
$key = $blog_id."-".$setting."-blog_option";
|
||||
$value = wp_cache_get( $key, "site-options" );
|
||||
if ( $value == null ) {
|
||||
if ( $blog_id == $wpdb->blogid ) {
|
||||
$value = get_option( $setting, $default );
|
||||
$notoptions = wp_cache_get( 'notoptions', 'options' );
|
||||
if ( isset( $notoptions[$setting] ) )
|
||||
wp_cache_set( $key, 'noop', 'site-options' );
|
||||
elseif ( $value == false )
|
||||
wp_cache_set( $key, 'falsevalue', 'site-options' );
|
||||
else
|
||||
wp_cache_set( $key, $value, 'site-options' );
|
||||
} else {
|
||||
$blog_prefix = $wpdb->get_blog_prefix( $blog_id );
|
||||
$row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$blog_prefix}options WHERE option_name = %s", $setting ) );
|
||||
if ( is_object( $row ) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values
|
||||
|
@ -262,6 +272,7 @@ function get_blog_option( $blog_id, $setting, $default = false ) {
|
|||
wp_cache_set( $key, 'noop', 'site-options' );
|
||||
$value = $default;
|
||||
}
|
||||
}
|
||||
} elseif ( $value == 'noop' ) {
|
||||
$value = $default;
|
||||
} elseif ( $value == 'falsevalue' ) {
|
||||
|
|
Loading…
Reference in New Issue