Make WordPress Core

Changeset 15168


Ignore:
Timestamp:
06/08/2010 01:00:09 PM (15 years ago)
Author:
ryan
Message:

Deprecate get_most_active_blogs() and get_blog_list(). Props ocean90. fixes #13773

Location:
trunk/wp-includes
Files:
3 edited

Legend:

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

    r14703 r15168  
    540540}
    541541
    542 function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
    543     global $wpdb;
    544 
    545     $blogs = get_site_option( "blog_list" );
    546     $update = false;
    547     if ( is_array( $blogs ) ) {
    548         if ( ( $blogs['time'] + 60 ) < time() ) { // cache for 60 seconds.
    549             $update = true;
    550         }
    551     } else {
    552         $update = true;
    553     }
    554 
    555     if ( $update == true ) {
    556         unset( $blogs );
    557         $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 );
    558 
    559         foreach ( (array) $blogs as $details ) {
    560             $blog_list[ $details['blog_id'] ] = $details;
    561             $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->base_prefix . $details['blog_id'] . "_posts WHERE post_status='publish' AND post_type='post'" );
    562         }
    563         unset( $blogs );
    564         $blogs = $blog_list;
    565         update_site_option( "blog_list", $blogs );
    566     }
    567 
    568     if ( false == is_array( $blogs ) )
    569         return array();
    570 
    571     if ( $num == 'all' )
    572         return array_slice( $blogs, $start, count( $blogs ) );
    573     else
    574         return array_slice( $blogs, $start, $num );
    575 }
    576 
    577542?>
  • trunk/wp-includes/ms-deprecated.php

    r14032 r15168  
    149149}
    150150
     151/**
     152 * @since MU
     153 * @deprecated 3.0.0
     154 */
     155function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
     156    _deprecated_function( __FUNCTION__, '3.0' );
     157    return 0;
     158}
     159
     160/**
     161 * @since MU
     162 * @deprecated 3.0.0
     163 */
     164function get_most_active_blogs( $num = 10, $display = true ) {
     165    _deprecated_function( __FUNCTION__, '3.0' );
     166    return 0;
     167}
    151168?>
  • trunk/wp-includes/ms-functions.php

    r15050 r15168  
    159159}
    160160
    161 function get_most_active_blogs( $num = 10, $display = true ) {
    162     $most_active = get_site_option( 'most_active' );
    163     $update = false;
    164     if ( is_array( $most_active ) ) {
    165         if ( ( $most_active['time'] + 60 ) < time() ) { // cache for 60 seconds.
    166             $update = true;
    167         }
    168     } else {
    169         $update = true;
    170     }
    171 
    172     if ( $update == true ) {
    173         unset( $most_active );
    174         $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
    175         if ( is_array( $blogs ) ) {
    176             reset( $blogs );
    177             foreach ( (array) $blogs as $key => $details ) {
    178                 $most_active[ $details['blog_id'] ] = $details['postcount'];
    179                 $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!!
    180             }
    181             arsort( $most_active );
    182             reset( $most_active );
    183             foreach ( (array) $most_active as $key => $details )
    184                 $t[ $key ] = $blog_list[ $key ];
    185 
    186             unset( $most_active );
    187             $most_active = $t;
    188         }
    189         update_site_option( 'most_active', $most_active );
    190     }
    191 
    192     if ( $display == true ) {
    193         if ( is_array( $most_active ) ) {
    194             reset( $most_active );
    195             foreach ( (array) $most_active as $key => $details ) {
    196                 $url = esc_url('http://' . $details['domain'] . $details['path']);
    197                 echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
    198             }
    199         }
    200     }
    201     return array_slice( $most_active, 0, $num );
    202 }
    203 
    204161function get_user_count() {
    205162    global $wpdb;
Note: See TracChangeset for help on using the changeset viewer.