Changeset 27888 for branches/3.7
- Timestamp:
- 04/01/2014 04:06:27 AM (11 years ago)
- Location:
- branches/3.7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.7
- Property svn:mergeinfo changed
/trunk merged: 26304-26305
- Property svn:mergeinfo changed
-
branches/3.7/src/wp-includes/option.php
r25926 r27888 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 ); … … 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 } … … 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() ) { … … 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 ) ) … … 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 } … … 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 -
branches/3.7/tests/phpunit/tests/option/siteOption.php
r25002 r27888 91 91 $this->assertFalse( get_site_option( $option ) ); 92 92 } 93 94 /** 95 * @group multisite 96 */ 97 function test_site_notoptions() { 98 if ( ! is_multisite() ) { 99 $this->markTestSkipped( 'Should only run in multisite' ); 100 } 101 102 global $wpdb; 103 $notoptions_key = "{$wpdb->siteid}:notoptions"; 104 105 $_notoptions = wp_cache_get( 'notoptions', 'site-options' ); 106 $this->assertEmpty( $_notoptions ); 107 $_notoptions1 = wp_cache_get( $notoptions_key, 'site-options' ); 108 $this->assertEmpty( $_notoptions1 ); 109 110 get_site_option( 'burrito' ); 111 112 $notoptions = wp_cache_get( 'notoptions', 'site-options' ); 113 $this->assertEmpty( $notoptions ); 114 $notoptions1 = wp_cache_get( $notoptions_key, 'site-options' ); 115 $this->assertNotEmpty( $notoptions1 ); 116 } 93 117 }
Note: See TracChangeset
for help on using the changeset viewer.