Ticket #50324: 50324.1.diff
File 50324.1.diff, 1.6 KB (added by , 4 years ago) |
---|
-
src/wp-includes/ms-site.php
69 69 return new WP_Error( 'db_insert_error', __( 'Could not insert site into the database.' ), $wpdb->last_error ); 70 70 } 71 71 72 clean_blog_cache( $wpdb->insert_id ); 72 $insert_id = $wpdb->insert_id; 73 clean_blog_cache( $insert_id ); 73 74 74 $new_site = get_site( $ wpdb->insert_id );75 $new_site = get_site( $insert_id ); 75 76 76 77 if ( ! $new_site ) { 77 78 return new WP_Error( 'get_site_error', __( 'Could not retrieve site data.' ) ); -
tests/phpunit/tests/multisite/site.php
1387 1387 } 1388 1388 1389 1389 /** 1390 * @ticket 50324 1391 */ 1392 public function test_wp_insert_site_with_clean_site_cache() { 1393 remove_action( 'wp_initialize_site', 'wp_initialize_site', 10 ); 1394 add_action( 'clean_site_cache', array( $this, 'action_database_insert_on_clean_site_cache' ) ); 1395 1396 $site_id = wp_insert_site( array( 1397 'domain' => 'valid-domain.com', 1398 'path' => '/valid-path/', 1399 'network_id' => 1, 1400 ) ); 1401 1402 $this->assertInternalType( 'integer', $site_id ); 1403 1404 } 1405 1406 public function action_database_insert_on_clean_site_cache() { 1407 update_site_option( 'database_write_test.'.time(), true ); 1408 } 1409 /** 1390 1410 * @ticket 40364 1391 1411 */ 1392 1412 public function test_wp_insert_site_empty_domain() {