Make WordPress Core


Ignore:
Timestamp:
12/20/2014 10:46:53 PM (12 years ago)
Author:
wonderboymusic
Message:

For clarity, initialize some arrays that previously were only assigned via short circuit in loops.

See #30799.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-deprecated.php

    r30176 r30982  
    167167        $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
    168168
     169        $blog_list = array();
    169170        foreach ( (array) $blogs as $details ) {
    170171                $blog_list[ $details['blog_id'] ] = $details;
    171172                $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );
    172173        }
    173         unset( $blogs );
    174         $blogs = $blog_list;
    175 
    176         if ( false == is_array( $blogs ) )
     174
     175        if ( ! $blog_list ) {
    177176                return array();
    178 
    179         if ( $num == 'all' )
    180                 return array_slice( $blogs, $start, count( $blogs ) );
    181         else
    182                 return array_slice( $blogs, $start, $num );
     177        }
     178
     179        if ( $num == 'all' ) {
     180                return array_slice( $blog_list, $start, count( $blog_list ) );
     181        } else {
     182                return array_slice( $blog_list, $start, $num );
     183        }
    183184}
    184185
Note: See TracChangeset for help on using the changeset viewer.