WordPress.org

Make WordPress Core

Changeset 12116


Ignore:
Timestamp:
10/27/09 15:51:58 (6 years ago)
Author:
ryan
Message:

Remove slow left join pending better solution. see #4529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r12042 r12116  
    767767        return $count; 
    768768 
    769     $where = 'WHERE '; 
    770     if( $post_id > 0 ) 
    771         $where .= $wpdb->prepare( "c.comment_post_ID = %d AND ", $post_id ); 
    772     $where .= "p.post_status <> 'trash'"; 
    773  
    774     $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID {$where} GROUP BY comment_approved", ARRAY_A ); 
     769    $where = ''; 
     770    if ( $post_id > 0 ) 
     771        $where = $wpdb->prepare( "comment_post_ID = %d AND ", $post_id ); 
     772 
     773    $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A ); 
    775774 
    776775    $total = 0; 
Note: See TracChangeset for help on using the changeset viewer.