Changeset 6341

Show
Ignore:
Timestamp:
11/18/07 19:36:30 (8 months ago)
Author:
ryan
Message:

Do two sets of filters on posts query. First set is used by regular plugins, second by caching plugins.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/query.php

    r6338 r6341  
    12331233        $where = apply_filters('posts_where_paged', $where); 
    12341234        $groupby = apply_filters('posts_groupby', $groupby); 
    1235         if ( ! empty($groupby) ) 
    1236             $groupby = 'GROUP BY ' . $groupby; 
    12371235        $join = apply_filters('posts_join_paged', $join); 
    12381236        $orderby = apply_filters('posts_orderby', $q['orderby']); 
    1239         if ( !empty( $orderby ) ) 
    1240             $orderby = 'ORDER BY ' . $orderby; 
    12411237        $distinct = apply_filters('posts_distinct', $distinct); 
    12421238        $fields = apply_filters('posts_fields', "$wpdb->posts.*"); 
    12431239        $limits = apply_filters( 'post_limits', $limits ); 
     1240 
     1241        // Announce current selection parameters.  For use by caching plugins. 
     1242        do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join ); 
     1243 
     1244        // Filter again for the benefit of caching plugins.  Regular plugins should use the hooks above. 
     1245        $where = apply_filters('posts_where_request', $where); 
     1246        $groupby = apply_filters('posts_groupby_request', $groupby); 
     1247        $join = apply_filters('posts_join_request', $join); 
     1248        $orderby = apply_filters('posts_orderby_request', $orderby); 
     1249        $distinct = apply_filters('posts_distinct_request', $distinct); 
     1250        $fields = apply_filters('posts_fields_request', $fields); 
     1251        $limits = apply_filters( 'post_limits_request', $limits ); 
     1252 
     1253        if ( ! empty($groupby) ) 
     1254            $groupby = 'GROUP BY ' . $groupby; 
     1255        if ( !empty( $orderby ) ) 
     1256            $orderby = 'ORDER BY ' . $orderby; 
    12441257        $found_rows = ''; 
    12451258        if ( !empty($limits) ) 
    12461259            $found_rows = 'SQL_CALC_FOUND_ROWS'; 
    1247  
    1248         // Announce current selection parameters.  For use by caching plugins. 
    1249         do_action( 'posts_selection', $where . $groupby . $q['orderby'] . $limits . $join ); 
    12501260 
    12511261        $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";