~canonical-sysadmins/wordpress/4.2.4

« back to all changes in this revision

Viewing changes to wp-includes/ms-deprecated.php

  • Committer: Paul Gear
  • Date: 2015-04-24 01:35:20 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: paul.gear@canonical.com-20150424013520-w4p9ksth76zh6opw
Merge new upstream release 4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
        global $wpdb;
167
167
        $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 );
168
168
 
 
169
        $blog_list = array();
169
170
        foreach ( (array) $blogs as $details ) {
170
171
                $blog_list[ $details['blog_id'] ] = $details;
171
172
                $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'" );
172
173
        }
173
 
        unset( $blogs );
174
 
        $blogs = $blog_list;
175
174
 
176
 
        if ( false == is_array( $blogs ) )
 
175
        if ( ! $blog_list ) {
177
176
                return array();
 
177
        }
178
178
 
179
 
        if ( $num == 'all' )
180
 
                return array_slice( $blogs, $start, count( $blogs ) );
181
 
        else
182
 
                return array_slice( $blogs, $start, $num );
 
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
        }
183
184
}
184
185
 
185
186
/**
193
194
        $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
194
195
        if ( is_array( $blogs ) ) {
195
196
                reset( $blogs );
 
197
                $most_active = array();
 
198
                $blog_list = array();
196
199
                foreach ( (array) $blogs as $key => $details ) {
197
200
                        $most_active[ $details['blog_id'] ] = $details['postcount'];
198
201
                        $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!!
199
202
                }
200
203
                arsort( $most_active );
201
204
                reset( $most_active );
202
 
                foreach ( (array) $most_active as $key => $details )
 
205
                $t = array();
 
206
                foreach ( (array) $most_active as $key => $details ) {
203
207
                        $t[ $key ] = $blog_list[ $key ];
204
 
 
 
208
                }
205
209
                unset( $most_active );
206
210
                $most_active = $t;
207
211
        }