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

Built from https://develop.svn.wordpress.org/trunk@31178


git-svn-id: http://core.svn.wordpress.org/trunk@31159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2015-01-14 05:33:25 +00:00
parent 19e51601ab
commit 8d55b418ec
2 changed files with 3 additions and 3 deletions

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;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-alpha-31177'; $wp_version = '4.2-alpha-31178';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.