Comment caching. Reduce queries on edit-comments.php page. Add non-persistent cache groups. Hat tip to hovenko. fixes #4387

git-svn-id: http://svn.automattic.com/wordpress/trunk@5666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2007-06-08 00:20:22 +00:00
parent fbfafcf27a
commit f2f6101e1c
5 changed files with 47 additions and 15 deletions

View File

@@ -250,6 +250,8 @@ function _wp_get_comment_list( $s = false, $start, $num ) {
$comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $num" );
}
update_comment_cache($comments);
$total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
return array($comments, $total);
@@ -260,7 +262,8 @@ function _wp_comment_list_item( $id, $alt = 0 ) {
$id = (int) $id;
$comment =& get_comment( $id );
$class = '';
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$post = get_post($comment->comment_post_ID);
$authordata = get_userdata($post->post_author);
$comment_status = wp_get_comment_status($comment->comment_ID);
if ( 'unapproved' == $comment_status )
$class .= ' unapproved';