Ticket #10911: 10911.diff
File 10911.diff, 776 bytes (added by , 15 years ago) |
---|
-
wp-admin/upload.php
20 20 if ( !current_user_can('edit_posts') ) 21 21 wp_die( __('You are not allowed to scan for lost attachments.') ); 22 22 23 $all_posts = implode(',', $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type IN ('post', 'page')")); 24 $lost = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent > '0' and post_parent NOT IN ($all_posts)"); 23 $lost = $wpdb->get_col("SELECT att.ID FROM $wpdb->posts as att LEFT JOIN $wpdb->posts as post ON att.post_parent = post.ID WHERE att.post_type = 'attachment' and post.ID IS NULL"); 25 24 26 25 $_GET['detached'] = 1; 27 26