[wp-trac] [WordPress Trac] #4301: Upload/browse area doubles thumbnails

WordPress Trac wp-trac at lists.automattic.com
Sun May 20 09:44:20 GMT 2007


#4301: Upload/browse area doubles thumbnails
----------------------------+-----------------------------------------------
 Reporter:  cricalix        |       Owner:  anonymous
     Type:  defect          |      Status:  new      
 Priority:  low             |   Milestone:  2.4      
Component:  Administration  |     Version:  2.2      
 Severity:  minor           |    Keywords:           
----------------------------+-----------------------------------------------
 Originally posted at http://wordpress.org/support/topic/118257

 Somewhere in the 2.x series of Wordpress, my file uploads started doubling
 up - I see double thumbnails for every image I upload (see
 http://www.cricalix.net/~dhill/wordpress-double-thumbs.jpg). The
 hyperlinks for each thumbnail are identical.

 This looks, to me, to be a problem down in upload-functions.php, in the
 wp_upload_tab_browse() function. It appears to get double attachment
 entries for any given post.

 Tracing the SQL executed:
 SELECT SQL_CALC_FOUND_ROWS posts.* FROM posts LEFT JOIN postmeta ON
 posts.ID = postmeta.post_id WHERE 1=1 AND (post_type = 'attachment') ORDER
 BY post_date DESC LIMIT 30, 10

 returns double entries for each post, and thus generates a doubled count
 for the next query that gets executed (the found_rows() query).

 If I mod the loop in that function, so that it keeps track of the last ID
 it saw:

 {{{
 if ( have_posts() ) : while ( have_posts() ) : the_post();
 if (get_the_ID() == $last_id) { continue; }
 .
 .
 $last_id = get_the_ID();
 endwhile;
 }}}
 the output to the browser is what I expect. However, I can't believe that
 Wordpress is this borked, so it's got to be something in my setup -- or
 one of the upgrades didn't update some of the schema properly?

 I've only got the Spam Karma plug-in, Lightbox plug-in, post levels and
 the usual moderation ones enabled - no plug-ins relating to uploads at
 all.

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


More information about the wp-trac mailing list