Ticket #10911: upload.php.patch
File upload.php.patch, 1.0 KB (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 = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'post' OR post_type = 'page'");24 $ all_att = $wpdb->get_results("SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'attachment'");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)"); 25 25 26 $lost = array();27 foreach ( (array) $all_att as $att ) {28 if ( $att->post_parent > 0 && ! in_array($att->post_parent, $all_posts) )29 $lost[] = $att->ID;30 }31 26 $_GET['detached'] = 1; 32 27 33 28 } elseif ( isset($_GET['found_post_id']) && isset($_GET['media']) ) {