From 048b96f80d3e3d1ef87dfe652e699851d4684794 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Wed, 20 Aug 2014 17:09:15 +0000 Subject: [PATCH] Media: Remove scan for lost attachments. This hasn't been worked for 4 years. fixes #29169. Built from https://develop.svn.wordpress.org/trunk@29550 git-svn-id: http://core.svn.wordpress.org/trunk@29326 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-media-list-table.php | 22 +++++-------------- wp-admin/upload.php | 15 ------------- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index f6b29ed6b2..eb1231498b 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -11,16 +11,16 @@ class WP_Media_List_Table extends WP_List_Table { /** * Constructor. - * + * * @since 3.1.0 * @access public * * @see WP_List_Table::__construct() for more information on default arguments. * * @param array $args An associative array of arguments. - */ + */ public function __construct( $args = array() ) { - $this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); + $this->detached = isset( $_REQUEST['detached'] ); parent::__construct( array( 'plural' => 'media', @@ -33,14 +33,9 @@ class WP_Media_List_Table extends WP_List_Table { } public function prepare_items() { - global $lost, $wp_query, $post_mime_types, $avail_post_mime_types, $mode; + global $wp_query, $post_mime_types, $avail_post_mime_types, $mode; - $q = $_REQUEST; - - if ( !empty( $lost ) ) - $q['post__in'] = implode( ',', $lost ); - - list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $q ); + list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST ); $this->is_trash = isset( $_REQUEST['status'] ) && 'trash' == $_REQUEST['status']; @@ -107,9 +102,7 @@ class WP_Media_List_Table extends WP_List_Table { submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); } - if ( $this->detached ) { - submit_button( __( 'Scan for lost attachments' ), 'secondary', 'find_detached', false ); - } elseif ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { + if ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); } ?> @@ -117,9 +110,6 @@ class WP_Media_List_Table extends WP_List_Table { } public function current_action() { - if ( isset( $_REQUEST['find_detached'] ) ) - return 'find_detached'; - if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) return 'attach'; diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 2e1e1afedb..18c3631491 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -89,21 +89,6 @@ if ( $doaction ) { } switch ( $doaction ) { - case 'find_detached': - if ( !current_user_can('edit_posts') ) - wp_die( __('You are not allowed to scan for lost attachments.') ); - - $lost = $wpdb->get_col( " - SELECT ID FROM $wpdb->posts - WHERE post_type = 'attachment' AND post_parent > '0' - AND post_parent NOT IN ( - SELECT ID FROM $wpdb->posts - WHERE post_type NOT IN ( 'attachment', '" . join( "', '", get_post_types( array( 'public' => false ) ) ) . "' ) - ) - " ); - - $_REQUEST['detached'] = 1; - break; case 'attach': $parent_id = (int) $_REQUEST['found_post_id']; if ( !$parent_id )