wp/wp-includes/ms-site.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   121 
   121 
   122 		/**
   122 		/**
   123 		 * Fires immediately after a new site is created.
   123 		 * Fires immediately after a new site is created.
   124 		 *
   124 		 *
   125 		 * @since MU (3.0.0)
   125 		 * @since MU (3.0.0)
   126 		 * @deprecated 5.1.0 Use {@see 'wp_insert_site'} instead.
   126 		 * @deprecated 5.1.0 Use {@see 'wp_initialize_site'} instead.
   127 		 *
   127 		 *
   128 		 * @param int    $site_id    Site ID.
   128 		 * @param int    $site_id    Site ID.
   129 		 * @param int    $user_id    User ID.
   129 		 * @param int    $user_id    User ID.
   130 		 * @param string $domain     Site domain.
   130 		 * @param string $domain     Site domain.
   131 		 * @param string $path       Site path.
   131 		 * @param string $path       Site path.
   134 		 */
   134 		 */
   135 		do_action_deprecated(
   135 		do_action_deprecated(
   136 			'wpmu_new_blog',
   136 			'wpmu_new_blog',
   137 			array( $new_site->id, $user_id, $new_site->domain, $new_site->path, $new_site->network_id, $meta ),
   137 			array( $new_site->id, $user_id, $new_site->domain, $new_site->path, $new_site->network_id, $meta ),
   138 			'5.1.0',
   138 			'5.1.0',
   139 			'wp_insert_site'
   139 			'wp_initialize_site'
   140 		);
   140 		);
   141 	}
   141 	}
   142 
   142 
   143 	return (int) $new_site->id;
   143 	return (int) $new_site->id;
   144 }
   144 }
   369  */
   369  */
   370 function update_site_cache( $sites, $update_meta_cache = true ) {
   370 function update_site_cache( $sites, $update_meta_cache = true ) {
   371 	if ( ! $sites ) {
   371 	if ( ! $sites ) {
   372 		return;
   372 		return;
   373 	}
   373 	}
   374 	$site_ids = array();
   374 	$site_ids          = array();
       
   375 	$site_data         = array();
       
   376 	$blog_details_data = array();
   375 	foreach ( $sites as $site ) {
   377 	foreach ( $sites as $site ) {
   376 		$site_ids[] = $site->blog_id;
   378 		$site_ids[]                                    = $site->blog_id;
   377 		wp_cache_add( $site->blog_id, $site, 'sites' );
   379 		$site_data[ $site->blog_id ]                   = $site;
   378 		wp_cache_add( $site->blog_id . 'short', $site, 'blog-details' );
   380 		$blog_details_data[ $site->blog_id . 'short' ] = $site;
   379 	}
   381 
       
   382 	}
       
   383 	wp_cache_add_multiple( $site_data, 'sites' );
       
   384 	wp_cache_add_multiple( $blog_details_data, 'blog-details' );
   380 
   385 
   381 	if ( $update_meta_cache ) {
   386 	if ( $update_meta_cache ) {
   382 		update_sitemeta_cache( $site_ids );
   387 		update_sitemeta_cache( $site_ids );
   383 	}
   388 	}
   384 }
   389 }
   975 	/**
   980 	/**
   976 	 * Fires immediately after a site has been removed from the object cache.
   981 	 * Fires immediately after a site has been removed from the object cache.
   977 	 *
   982 	 *
   978 	 * @since 4.6.0
   983 	 * @since 4.6.0
   979 	 *
   984 	 *
   980 	 * @param int     $id              Blog ID.
   985 	 * @param string  $id              Site ID as a numeric string.
   981 	 * @param WP_Site $blog            Site object.
   986 	 * @param WP_Site $blog            Site object.
   982 	 * @param string  $domain_path_key md5 hash of domain and path.
   987 	 * @param string  $domain_path_key md5 hash of domain and path.
   983 	 */
   988 	 */
   984 	do_action( 'clean_site_cache', $blog_id, $blog, $domain_path_key );
   989 	do_action( 'clean_site_cache', $blog_id, $blog, $domain_path_key );
   985 
   990