Make WordPress Core

Ticket #46125: 46125.diff

File 46125.diff, 1.5 KB (added by david.binda, 6 years ago)
  • src/wp-includes/ms-site.php

     
    723723                )
    724724        );
    725725
     726        // Clean blog cache after populating options.
     727        clean_blog_cache( get_current_blog_id() );
     728
    726729        // Populate the site's roles.
    727730        populate_roles();
    728731        $wp_roles = new WP_Roles();
  • tests/phpunit/tests/multisite/site.php

     
    23202320
    23212321                        return $args;
    23222322                }
     2323
     2324                public function test_wpmu_create_blog_cache_cleanup_backward_compatible() {
     2325                        add_action( 'populate_options', array( $this, 'populate_options_callback' ) );
     2326
     2327                        $blog_id = wpmu_create_blog( "testsite1.example.org", "/test" , 'test', 1, array( 'public' => 1 ), 2 );
     2328
     2329                        // Should not hit blog_details cache initialised in $this->populate_options_callback tirggered during
     2330                        // populate_options callback's call of get_blog_details.
     2331                        $this->assertEquals( 'http://testsite1.example.org/test', get_blog_details( $blog_id )->siteurl );
     2332
     2333                        remove_action( 'populate_options', array( $this, 'populate_options_callback' ) );
     2334                }
     2335
     2336                public function populate_options_callback() {
     2337                        // Cache blog details
     2338                        get_blog_details( get_current_blog_id() );
     2339                        // Set siteurl
     2340                        update_option( 'siteurl', 'http://testsite1.example.org/test' );
     2341                }
    23232342        }
    23242343
    23252344endif;