Changeset 29550
- Timestamp:
- 08/20/2014 05:08:41 PM (10 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-media-list-table.php
r29460 r29550 12 12 /** 13 13 * Constructor. 14 * 14 * 15 15 * @since 3.1.0 16 16 * @access public … … 19 19 * 20 20 * @param array $args An associative array of arguments. 21 */ 21 */ 22 22 public function __construct( $args = array() ) { 23 $this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] );23 $this->detached = isset( $_REQUEST['detached'] ); 24 24 25 25 parent::__construct( array( … … 34 34 35 35 public function prepare_items() { 36 global $lost, $wp_query, $post_mime_types, $avail_post_mime_types, $mode; 37 38 $q = $_REQUEST; 39 40 if ( !empty( $lost ) ) 41 $q['post__in'] = implode( ',', $lost ); 42 43 list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $q ); 36 global $wp_query, $post_mime_types, $avail_post_mime_types, $mode; 37 38 list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST ); 44 39 45 40 $this->is_trash = isset( $_REQUEST['status'] ) && 'trash' == $_REQUEST['status']; … … 108 103 } 109 104 110 if ( $this->detached ) { 111 submit_button( __( 'Scan for lost attachments' ), 'secondary', 'find_detached', false ); 112 } elseif ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { 105 if ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { 113 106 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); 114 107 } ?> … … 118 111 119 112 public function current_action() { 120 if ( isset( $_REQUEST['find_detached'] ) )121 return 'find_detached';122 123 113 if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) 124 114 return 'attach'; -
trunk/src/wp-admin/upload.php
r29280 r29550 90 90 91 91 switch ( $doaction ) { 92 case 'find_detached':93 if ( !current_user_can('edit_posts') )94 wp_die( __('You are not allowed to scan for lost attachments.') );95 96 $lost = $wpdb->get_col( "97 SELECT ID FROM $wpdb->posts98 WHERE post_type = 'attachment' AND post_parent > '0'99 AND post_parent NOT IN (100 SELECT ID FROM $wpdb->posts101 WHERE post_type NOT IN ( 'attachment', '" . join( "', '", get_post_types( array( 'public' => false ) ) ) . "' )102 )103 " );104 105 $_REQUEST['detached'] = 1;106 break;107 92 case 'attach': 108 93 $parent_id = (int) $_REQUEST['found_post_id'];
Note: See TracChangeset
for help on using the changeset viewer.