summaryrefslogtreecommitdiffstats
path: root/wp-includes/comment.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-24 11:45:39 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-24 11:45:39 +0000
commitcf9f85dc8121a359d550ffa3b735fb48859eee88 (patch)
tree9f90be15fc46163f5656f019f2a2866414b7c9f2 /wp-includes/comment.php
parentf10f9f5b05e23ce4c07479b094bd3ff4bbfd86d0 (diff)
downloadwordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.gz
wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.xz
wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.zip
Merged with WP 2.5, revision 7806
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1260 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/comment.php')
-rw-r--r--wp-includes/comment.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 94479fb..63e6b1b 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -451,6 +451,11 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
function wp_count_comments() {
global $wpdb;
+ $count = wp_cache_get('comments', 'counts');
+
+ if ( false !== $count )
+ return $count;
+
$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} GROUP BY comment_approved", ARRAY_A );
$stats = array( );
@@ -464,7 +469,10 @@ function wp_count_comments() {
$stats[$key] = 0;
}
- return (object) $stats;
+ $stats = (object) $stats;
+ wp_cache_set('comments', $stats, 'counts');
+
+ return $stats;
}
/**