Make WordPress Core

Opened 18 years ago

Closed 17 years ago

#2566 closed defect (bug) (fixed)

moderation.php needs paging

Reported by: fimion's profile fimion Owned by: rob1n's profile rob1n
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.0
Component: Administration Keywords: needs-patch
Focuses: Cc:


In wp-admin/moderation.php on line 123,

$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'");

can cause php to hit it's internal memory limit if there are too many comments in moderation (generally caused by spam). To remedy this, I suggest you add a limit to the number of results returned.

so something like

$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0' ORDER BY `comment_date` ASC LIMIT 0 , 100");

This will sort oldest to newest and only return 100.

This was brought up due to a case of a blog with 2000+ spam comments in moderation, and the guy couldn't moderate them.

Change History (13)

#1 @fimion
18 years ago

  • Cc fimion@… added
  • Component changed from Administration to Optimization
  • Priority changed from normal to high
  • Severity changed from normal to major

#2 @davidhouse
18 years ago

  • Priority changed from high to low
  • Severity changed from major to minor

I hardly think it's worthy of major severity if it only hits when you've got 2000 spam comments. That's a minority target audience if I ever did see one.

#3 @davidhouse
18 years ago

Hmmm... paging would fix this, right? I think some generalised paging code that we could apply to here and other places in the admin that need it would be nice to see.

#4 @fimion
18 years ago

yes paging code would also fix this. The above is just a dirty hack for a blog that had become a victim of massive amounts of spam.

#5 @markjaquith
18 years ago

  • Milestone set to 2.1
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Might be a good candidate for paging, using the helper function introduced here: #3159

#6 @matt
18 years ago

  • Resolution set to wontfix
  • Status changed from assigned to closed

#7 @rob1n
17 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.1 to 2.3
  • Resolution wontfix deleted
  • Status changed from closed to reopened

I think this is worth taking another look at for 2.3. #4212 was reported with the same problem, again.

#8 @rob1n
17 years ago

  • Owner changed from markjaquith to rob1n
  • Status changed from reopened to new

#9 @rob1n
17 years ago

  • Status changed from new to assigned

#10 @rob1n
17 years ago

  • Component changed from Optimization to Administration
  • Priority changed from low to normal
  • Severity changed from minor to normal

#12 @rob1n
17 years ago

  • Summary changed from moderation may fail due to memory constraints to moderation.php needs paging

#13 @rob1n
17 years ago

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

Fixed in [5574].

Note: See TracTickets for help on using tickets.