Don't overcheck the expected return from get_blog_details() in get_blogaddress_by_id()

If `get_blog_details()` is returning something that is not our expected object or `false`, then a notice would already be thrown there.

Also adds proper return docs to `get_blog_details()`.

Props SergeyBiryukov.

Fixes #30566


git-svn-id: https://develop.svn.wordpress.org/trunk@31178 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt 2015-01-14 05:32:19 +00:00
parent 02d9bcbb7c
commit 1a930c5d43

View File

@ -37,7 +37,7 @@ function wpmu_update_blogs_date() {
*/ */
function get_blogaddress_by_id( $blog_id ) { function get_blogaddress_by_id( $blog_id ) {
$bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details! $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
return isset( $bloginfo->domain ) && isset( $bloginfo->path ) ? esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ) : ''; return ( $bloginfo ) ? esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ) : '';
} }
/** /**
@ -99,7 +99,7 @@ function get_id_from_blogname( $slug ) {
* *
* @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against. Optional. If not specified the current blog ID is used. * @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against. Optional. 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. * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
* @return object Blog details. * @return object|false Blog details on success. False on failure.
*/ */
function get_blog_details( $fields = null, $get_all = true ) { function get_blog_details( $fields = null, $get_all = true ) {
global $wpdb; global $wpdb;