Make WordPress Core


Ignore:
Timestamp:
10/16/2017 10:28:52 PM (7 years ago)
Author:
flixos90
Message:

Multisite: Revert [41719].

While get_site_by() makes sense as a more explicit and less complex replacement for get_blog_details(), it is not ready yet in terms of caching, where it currently falls short of the older function under specific circumstances.

See #40180, #40228.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/siteDetails.php

    r41719 r41883  
    3333     * @ticket 40063
    3434     */
     35    public function test_update_whitelisted_option_deletes_blog_details_cache( $whitelisted_option, $temporary_value ) {
     36        $blog_details = get_blog_details();
     37
     38        $original_value = $blog_details->$whitelisted_option;
     39        update_option( $whitelisted_option, $temporary_value );
     40
     41        $cached_result = wp_cache_get( $blog_details->id, 'blog-details' );
     42
     43        /* Reset to original value. */
     44        update_option( $whitelisted_option, $original_value );
     45
     46        $this->assertFalse( $cached_result );
     47    }
     48
     49    /**
     50     * @dataProvider data_whitelisted_options
     51     *
     52     * @ticket 40063
     53     */
    3554    public function test_update_whitelisted_option_does_not_delete_site_cache( $whitelisted_option, $temporary_value ) {
    3655        $site = get_site();
     
    4059
    4160        $cached_result = wp_cache_get( $site->id, 'sites' );
     61
     62        /* Reset to original value. */
     63        update_option( $whitelisted_option, $original_value );
     64
     65        $this->assertNotFalse( $cached_result );
     66    }
     67
     68    /**
     69     * @dataProvider data_whitelisted_options
     70     *
     71     * @ticket 40063
     72     */
     73    public function test_update_whitelisted_option_does_not_delete_short_blog_details_cache( $whitelisted_option, $temporary_value ) {
     74        $blog_details = get_blog_details( null, false );
     75
     76        $original_value = get_option( $whitelisted_option );
     77        update_option( $whitelisted_option, $temporary_value );
     78
     79        $cached_result = wp_cache_get( $blog_details->id . 'short', 'blog-details' );
    4280
    4381        /* Reset to original value. */
Note: See TracChangeset for help on using the changeset viewer.