WordPress.org

Make WordPress Core

Changeset 18588


Ignore:
Timestamp:
08/23/2011 08:45:48 PM (9 years ago)
Author:
duck_
Message:

Use get_site_option in add/update_site_option for caching and filtering benefits. fixes #18478

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r18587 r18588  
    38003800        $cache_key = "{$wpdb->siteid}:$option";
    38013801
    3802         if ( $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ) )
     3802        if ( false !== get_site_option( $option ) )
    38033803            return false;
    38043804
     
    38073807
    38083808        $_value = $value;
    3809         $value = maybe_serialize($value);
     3809        $value = maybe_serialize( $value );
    38103810        $result = $wpdb->insert( $wpdb->sitemeta, array('site_id' => $wpdb->siteid, 'meta_key' => $option, 'meta_value' => $value ) );
    38113811        $value = $_value;
     
    38873887        return false;
    38883888
     3889    if ( $value && false === $oldvalue )
     3890        return add_site_option( $option, $value );
     3891
    38893892    if ( !is_multisite() ) {
    38903893        $result = update_option( $option, $value );
    38913894    } else {
     3895        $value = sanitize_option( $option, $value );
    38923896        $cache_key = "{$wpdb->siteid}:$option";
    3893 
    3894         if ( $value && !$wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ) )
    3895             return add_site_option( $option, $value );
    3896         $value = sanitize_option( $option, $value );
    38973897        wp_cache_set( $cache_key, $value, 'site-options' );
    38983898
Note: See TracChangeset for help on using the changeset viewer.