Skip to:
Content

BuddyPress.org

Changeset 8071


Ignore:
Timestamp:
03/06/2014 08:34:16 PM (10 years ago)
Author:
boonebgorges
Message:

Streamline COUNT query in BP_Activity_Activity::get

It's unnecessary to use an ORDER BY clause when counting, and the index hint
was doing more harm than good, especially in cases where a specific ID was
passed.

See #5448

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-classes.php

    r8027 r8071  
    424424        }
    425425
    426         $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $where_sql, $sort );
     426        $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );
    427427        $total_activities     = $wpdb->get_var( $total_activities_sql );
    428428
Note: See TracChangeset for help on using the changeset viewer.