Make WordPress Core


Ignore:
Timestamp:
11/21/2013 07:06:26 PM (11 years ago)
Author:
wonderboymusic
Message:

Prefix the notoptions cache key in the multisite site-options group with $wpdb->siteid to avoid collisions and race conditions when using a fancy multi-network setup. Adds unit test.

Fixes #25883.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/option/siteOption.php

    r25002 r26304  
    9191        $this->assertFalse( get_site_option( $option ) );
    9292    }
     93
     94    /**
     95     * @group multisite
     96     */
     97    function test_site_notoptions() {
     98        global $wpdb;
     99        $notoptions_key = "{$wpdb->siteid}:notoptions";
     100
     101        $_notoptions = wp_cache_get( 'notoptions', 'site-options' );
     102        $this->assertEmpty( $_notoptions );
     103        $_notoptions1 = wp_cache_get( $notoptions_key, 'site-options' );
     104        $this->assertEmpty( $_notoptions1 );
     105
     106        get_site_option( 'burrito' );
     107
     108        $notoptions = wp_cache_get( 'notoptions', 'site-options' );
     109        $this->assertEmpty( $notoptions );
     110        $notoptions1 = wp_cache_get( $notoptions_key, 'site-options' );
     111        $this->assertNotEmpty( $notoptions1 );
     112    }
    93113}
Note: See TracChangeset for help on using the changeset viewer.