X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0459461f9ea42e0b090759ff6fe5f48360bef750..refs/tags/wordpress-4.5:/wp-includes/ms-blogs.php diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php index 0701f17f..9108d59e 100644 --- a/wp-includes/ms-blogs.php +++ b/wp-includes/ms-blogs.php @@ -9,7 +9,7 @@ */ /** - * Update the last_updated field for the current blog. + * Update the last_updated field for the current site. * * @since MU * @@ -24,7 +24,7 @@ function wpmu_update_blogs_date() { * * @since MU * - * @param int $blog_id Blog ID. + * @param int $blog_id Site ID. */ do_action( 'wpmu_blog_updated', $wpdb->blogid ); } @@ -115,7 +115,7 @@ function get_id_from_blogname( $slug ) { * If not specified the current blog ID is used. * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. * Default is true. - * @return object|false Blog details on success. False on failure. + * @return WP_Site|false Blog details on success. False on failure. */ function get_blog_details( $fields = null, $get_all = true ) { global $wpdb; @@ -210,7 +210,7 @@ function get_blog_details( $fields = null, $get_all = true ) { } if ( empty($details) ) { - $details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE blog_id = %d /* get_blog_details */", $blog_id ) ); + $details = WP_Site::get_instance( $blog_id ); if ( ! $details ) { // Set the full cache. wp_cache_set( $blog_id, -1, 'blog-details' ); @@ -218,6 +218,10 @@ function get_blog_details( $fields = null, $get_all = true ) { } } + if ( ! $details instanceof WP_Site ) { + $details = new WP_Site( $details ); + } + if ( ! $get_all ) { wp_cache_set( $blog_id . $all, $details, 'blog-details' ); return $details; @@ -436,12 +440,13 @@ function update_blog_details( $blog_id, $details = array() ) { * * @since 3.5.0 * - * @param stdClass $blog The blog details as returned from get_blog_details() + * @param WP_Site $blog The blog details as returned from get_blog_details() */ function clean_blog_cache( $blog ) { $blog_id = $blog->blog_id; $domain_path_key = md5( $blog->domain . $blog->path ); + wp_cache_delete( $blog_id, 'sites' ); wp_cache_delete( $blog_id , 'blog-details' ); wp_cache_delete( $blog_id . 'short' , 'blog-details' ); wp_cache_delete( $domain_path_key, 'blog-lookup' ); @@ -559,9 +564,10 @@ function delete_blog_option( $id, $option ) { * * @since MU * - * @param int $id The blog id - * @param string $option The option key - * @param mixed $value The option value + * @param int $id The blog id. + * @param string $option The option key. + * @param mixed $value The option value. + * @param mixed $deprecated Not used. * @return bool True on success, false on failure. */ function update_blog_option( $id, $option, $value, $deprecated = null ) { @@ -654,7 +660,7 @@ function switch_to_blog( $new_blog, $deprecated = null ) { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { - wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks' ) ); + wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites' ) ); } wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); } @@ -725,7 +731,7 @@ function restore_current_blog() { if ( is_array( $global_groups ) ) { wp_cache_add_global_groups( $global_groups ); } else { - wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks' ) ); + wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites' ) ); } wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); } @@ -985,4 +991,3 @@ function _update_posts_count_on_transition_post_status( $new_status, $old_status update_posts_count(); } -