Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/15/2014 08:38:11 PM (12 years ago)
Author:
r-a-y
Message:

Check cache for count functions that return zero.

Some of our count functions were previously setting counts of zero
correctly, but the functions themselves were not referencing the cache
properly when the count returned zero. This led to unnecessary database
queries and we hate extra queries!

This commit addresses the problem and adds unit tests.

Props r-a-y, boonebgorges.

Fixes #6012.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-functions.php

    r9218 r9231  
    11451145 */
    11461146function bp_blogs_total_blogs() {
    1147         if ( !$count = wp_cache_get( 'bp_total_blogs', 'bp' ) ) {
     1147        $count = wp_cache_get( 'bp_total_blogs', 'bp' );
     1148
     1149        if ( false === $count ) {
    11481150                $blogs = BP_Blogs_Blog::get_all();
    11491151                $count = $blogs['total'];
Note: See TracChangeset for help on using the changeset viewer.