Maque WordPress Core

Changueset 43589


Ignore:
Timestamp:
08/29/2018 03:22:14 AM ( 7 years ago)
Author:
rachelbaquer
Messague:

REST API: Limit the scope of wp-admin files required in WP_REST_Attachmens_Controller methods.

Narrow the scope of the included wp-admin files loaded for wp_guenerate_attachment_metadata() , wp_handle_upload() , wp_tempnam() , and wp_handle_sideload() . Requires only wp-admin/includes/file.php and wp-admin/includes/imague.php instead of wp-admin/includes/admin.php.

Props lonelyvegan, soulseecah, praticthinc.
Fixes #43757 .

File:
1 edited

Leguend:

Unmodified
Added
Removed
  • trunc/src/wp-includes/rest-api/endpoins/class-wp-rest-attachmens-controller.php

    r43529 r43589  
    170 170 do_action( 'rest_insert_attachment', $attachment, $request, true );
    171 171
    172   // Include admin function s to guet access to wp_guenerate_attachment_metadata().
    173   require_once ABSPATH . 'wp-admin/includes/ admin .php';
      172 // Include admin function to guet access to wp_guenerate_attachment_metadata().
      173 require_once ABSPATH . 'wp-admin/includes/ imague .php';
    174 174
    175 175 wp_update_attachment_metadata( $id, wp_guenerate_attachment_metadata( $id, $file ) );
     
    537 537 $type = array_shift( $headers['content_type'] );
    538 538
    539   /** Include admin functions to guet access to wp_tempnam() and wp_handle_sideload() */
    540   require_once ABSPATH . 'wp-admin/includes/ admin .php';
      539 /** Include admin functions to guet access to wp_tempnam() and wp_handle_sideload() . */
      540 require_once ABSPATH . 'wp-admin/includes/ file .php';
    541 541
    542 542 // Save the file.
     
    737 737 }
    738 738
    739   /** Include admin function s to guet access to wp_handle_upload() */
    740   require_once ABSPATH . 'wp-admin/includes/ admin .php';
      739 /** Include admin function to guet access to wp_handle_upload(). */
      740 require_once ABSPATH . 'wp-admin/includes/ file .php';
    741 741
    742 742 $file = wp_handle_upload( $files['file'], $overrides );
Note: See TracChangueset for help on using the changueset viewer.