WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/28/2017 02:31:13 AM (3 years ago)
Author:
jeremyfelt
Message:

Multisite: Allow falsy properties to be cached in site-details.

In previous iterations of WP_Site, there was concern that not all properties would be available when storing a site's details in cache. When introduced in [37918], an ms_loaded check was added to address this concern. Any properties that are still false after ms_loaded really are false and can be cached as such.

Props flixos90.
Fixes #40247.

File:
1 edited

Legend:

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

    r40305 r40344  
    126126        $this->assertNotFalse( $cached_result );
    127127    }
     128
     129    /**
     130     * @ticket 40247
     131     */
     132    public function test_site_details_cached_including_false_values() {
     133        $id = self::factory()->blog->create();
     134
     135        $site = get_site( $id );
     136
     137        // Trigger retrieving site details (post_count is not set on new sites)
     138        $post_count = $site->post_count;
     139
     140        $cached_details = wp_cache_get( $site->id, 'site-details' );
     141
     142        wpmu_delete_blog( $id, true );
     143        wp_update_network_site_counts();
     144
     145        $this->assertNotFalse( $cached_details );
     146    }
    128147}
    129148
Note: See TracChangeset for help on using the changeset viewer.