Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#15961 closed defect (bug) (fixed)

WP_Comments_List_Table causes get_pending_comments_num to run a lame query

Reported by: westi's profile westi Owned by: westi's profile westi
Milestone: 3.2 Priority: normal
Severity: normal Version: 3.1
Component: Comments Keywords: has-patch
Focuses: Cc:

Description (last modified by westi)

In WP_Comments_List_Table::prepare_items we call get_comments to get the comments for the current view.

We then loop through the comments to build an array of post_ids.

We then call get_pending_comments_num with this array of ids.

At no point does prepare_items or get_pending_comments_num do any thing to the array to ensure uniqueness.

Therefore we run queries like this:

SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM wp__comments WHERE comment_post_ID IN ( '627', '627', '1', '5', '1', '20', '40', '30', '20', '10', '10', '627', '627', '627', '627', '627', '627', '627', '627', '627' ) AND comment_approved = '0' GROUP BY comment_post_ID

Attachments (1)

15961.patch (520 bytes) - added by SergeyBiryukov 14 years ago.

Download all attachments as: .zip

Change History (7)

#1 @westi
14 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
14 years ago

  • Keywords has-patch added

#3 @ramiy
13 years ago

Related #17275 (?)

#4 @SergeyBiryukov
13 years ago

  • Keywords 3.2-early removed
  • Milestone changed from Future Release to 3.3

#5 @westi
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Was fixed in [18041]

#6 @SergeyBiryukov
13 years ago

  • Milestone changed from 3.3 to 3.2
Note: See TracTickets for help on using tickets.