Make WordPress Core

Ticket #12755: 12755.patch

File 12755.patch, 1.3 KB (added by sbressler, 14 years ago)

My first stab at a patch

  • wp-admin/upload.php

     
    140140                $page_links_total = ceil(count($lost) / $media_per_page);
    141141                $lost = implode(',', $lost);
    142142
    143                 $orphans = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN (%s) LIMIT %d, %d", $lost, $start, $media_per_page ) );
     143                $orphans = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN (%s) ORDER BY post_date DESC LIMIT %d, %d", $lost, $start, $media_per_page ) );
    144144        } else {
    145145                $start = ( (int) $_GET['paged'] - 1 ) * $media_per_page;
    146                 $orphans = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1 LIMIT %d, %d", $start, $media_per_page ) );
     146                $orphans = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1 ORDER BY post_date DESC LIMIT %d, %d", $start, $media_per_page ) );
    147147                $total_orphans = $wpdb->get_var( "SELECT FOUND_ROWS()" );
    148148                $page_links_total = ceil( $total_orphans / $media_per_page );
    149149        }