Ticket #25883: 25883.diff
| File 25883.diff, 2.7 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/option.php
757 757 return $pre; 758 758 759 759 // prevent non-existent options from triggering multiple queries 760 $notoptions = wp_cache_get( 'notoptions', 'site-options' ); 760 $notoptions_key = "{$wpdb->siteid}:notoptions"; 761 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); 761 762 if ( isset( $notoptions[$option] ) ) 762 763 return apply_filters( 'default_site_option_' . $option, $default ); 763 764 … … 779 780 wp_cache_set( $cache_key, $value, 'site-options' ); 780 781 } else { 781 782 $notoptions[$option] = true; 782 wp_cache_set( 'notoptions', $notoptions, 'site-options' );783 wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); 783 784 $value = apply_filters( 'default_site_option_' . $option, $default ); 784 785 } 785 786 } … … 812 813 wp_protect_special_option( $option ); 813 814 814 815 $value = apply_filters( 'pre_add_site_option_' . $option, $value ); 816 $notoptions_key = "{$wpdb->siteid}:notoptions"; 815 817 816 818 if ( !is_multisite() ) { 817 819 $result = add_option( $option, $value ); … … 819 821 $cache_key = "{$wpdb->siteid}:$option"; 820 822 821 823 // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query 822 $notoptions = wp_cache_get( 'notoptions', 'site-options' );824 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); 823 825 if ( ! is_array( $notoptions ) || ! isset( $notoptions[$option] ) ) 824 826 if ( false !== get_site_option( $option ) ) 825 827 return false; … … 835 837 wp_cache_set( $cache_key, $value, 'site-options' ); 836 838 837 839 // This option exists now 838 $notoptions = wp_cache_get( 'notoptions', 'site-options' ); // yes, again... we need it to be fresh840 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // yes, again... we need it to be fresh 839 841 if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) { 840 842 unset( $notoptions[$option] ); 841 wp_cache_set( 'notoptions', $notoptions, 'site-options' );843 wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); 842 844 } 843 845 } 844 846 … … 922 924 if ( false === $old_value ) 923 925 return add_site_option( $option, $value ); 924 926 925 $notoptions = wp_cache_get( 'notoptions', 'site-options' ); 927 $notoptions_key = "{$wpdb->siteid}:notoptions"; 928 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); 926 929 if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) { 927 930 unset( $notoptions[$option] ); 928 wp_cache_set( 'notoptions', $notoptions, 'site-options' );931 wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); 929 932 } 930 933 931 934 if ( !is_multisite() ) {