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

git-svn-id: http://svn.automattic.com/wordpress/trunk@15168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-06-08 13:00:09 +00:00
parent ebe57d5b69
commit 76036b069b
3 changed files with 17 additions and 78 deletions

View File

@ -539,39 +539,4 @@ function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
return $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' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );
}
function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
global $wpdb;
$blogs = get_site_option( "blog_list" );
$update = false;
if ( is_array( $blogs ) ) {
if ( ( $blogs['time'] + 60 ) < time() ) { // cache for 60 seconds.
$update = true;
}
} else {
$update = true;
}
if ( $update == true ) {
unset( $blogs );
$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->base_prefix . $details['blog_id'] . "_posts WHERE post_status='publish' AND post_type='post'" );
}
unset( $blogs );
$blogs = $blog_list;
update_site_option( "blog_list", $blogs );
}
if ( false == is_array( $blogs ) )
return array();
if ( $num == 'all' )
return array_slice( $blogs, $start, count( $blogs ) );
else
return array_slice( $blogs, $start, $num );
}
?>

View File

@ -148,4 +148,21 @@ function validate_email( $email, $check_domain = true) {
return is_email( $email, $check_domain );
}
/**
* @since MU
* @deprecated 3.0.0
*/
function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
_deprecated_function( __FUNCTION__, '3.0' );
return 0;
}
/**
* @since MU
* @deprecated 3.0.0
*/
function get_most_active_blogs( $num = 10, $display = true ) {
_deprecated_function( __FUNCTION__, '3.0' );
return 0;
}
?>

View File

@ -158,49 +158,6 @@ function is_user_member_of_blog( $user_id, $blog_id = 0 ) {
return false;
}
function get_most_active_blogs( $num = 10, $display = true ) {
$most_active = get_site_option( 'most_active' );
$update = false;
if ( is_array( $most_active ) ) {
if ( ( $most_active['time'] + 60 ) < time() ) { // cache for 60 seconds.
$update = true;
}
} else {
$update = true;
}
if ( $update == true ) {
unset( $most_active );
$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;
}
update_site_option( 'most_active', $most_active );
}
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 );
}
function get_user_count() {
global $wpdb;