[wp-trac] [WordPress Trac] #2566: moderation may fail due to memory constraints

WordPress Trac wp-trac at lists.automattic.com
Tue Mar 14 03:43:07 GMT 2006


#2566: moderation may fail due to memory constraints
----------------------------+-----------------------------------------------
       Id:  2566            |      Status:  new                     
Component:  Administration  |    Modified:  Tue Mar 14 03:43:07 2006
 Severity:  normal          |   Milestone:                          
 Priority:  normal          |     Version:  2.0                     
    Owner:  anonymous       |    Reporter:  fimion                  
----------------------------+-----------------------------------------------
 In wp-admin/moderation.php on line 123,

 {{{
 #!php
 $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

 {{{
 #!php
 $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.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2566>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list