Make WordPress Core

Changeset 14789


Ignore:
Timestamp:
05/21/2010 07:23:52 PM (15 years ago)
Author:
nacin
Message:

Exclusion instead of inclusion for post types for lost attachment scan. Exclude attachments and any !public types, and don't consider attachments on unregistered post types to be lost. fixes #10911.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upload.php

    r14701 r14789  
    2121        wp_die( __('You are not allowed to scan for lost attachments.') );
    2222
    23     $all_posts = implode( ',', $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type IN ('" . join("', '", get_post_types() ) . "')"));
     23    $all_posts = implode( ',', $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type NOT IN ('attachment', '" . join("', '", get_post_types( array( 'public' => false ) ) ) . "')" ) );
    2424    $lost = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent > '0' and post_parent NOT IN ($all_posts)");
    2525   
Note: See TracChangeset for help on using the changeset viewer.