Resurrect get_blog_list() and get_most_active_blogs() but leave deprecated. Props ocean90. fixes #13773

git-svn-id: https://develop.svn.wordpress.org/trunk@15170 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-06-08 13:56:20 +00:00
parent c0570f3494
commit ce41df6dd6
1 changed files with 49 additions and 4 deletions

View File

@ -151,18 +151,63 @@ function validate_email( $email, $check_domain = true) {
/**
* @since MU
* @deprecated 3.0.0
* @deprecated Don't use this, really.
*/
function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
_deprecated_function( __FUNCTION__, '3.0' );
return 0;
_deprecated_function( __FUNCTION__, '3.0', "Don't use this, really." );
global $wpdb;
$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 );
foreach ( (array) $blogs as $details ) {
$blog_list[ $details['blog_id'] ] = $details;
$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'" );
}
unset( $blogs );
$blogs = $blog_list;
if ( false == is_array( $blogs ) )
return array();
if ( $num == 'all' )
return array_slice( $blogs, $start, count( $blogs ) );
else
return array_slice( $blogs, $start, $num );
}
/**
* @since MU
* @deprecated 3.0.0
* @deprecated Don't use this, really.
*/
function get_most_active_blogs( $num = 10, $display = true ) {
_deprecated_function( __FUNCTION__, '3.0' );
return 0;
_deprecated_function( __FUNCTION__, '3.0', "Don't use this, really." );
$blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
if ( is_array( $blogs ) ) {
reset( $blogs );
foreach ( (array) $blogs as $key => $details ) {
$most_active[ $details['blog_id'] ] = $details['postcount'];
$blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!!
}
arsort( $most_active );
reset( $most_active );
foreach ( (array) $most_active as $key => $details )
$t[ $key ] = $blog_list[ $key ];
unset( $most_active );
$most_active = $t;
}
if ( $display == true ) {
if ( is_array( $most_active ) ) {
reset( $most_active );
foreach ( (array) $most_active as $key => $details ) {
$url = esc_url('http://' . $details['domain'] . $details['path']);
echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
}
}
}
return array_slice( $most_active, 0, $num );
}
?>