Make WordPress Core

Ticket #43757: 43757.diff

File 43757.diff, 1.7 KB (added by soulseekah, 7 years ago)

leaner includes

  • src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    index 30ddafc..1d9abfe 100644
    class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    170170                do_action( 'rest_insert_attachment', $attachment, $request, true );
    171171
    172172                // Include admin functions to get access to wp_generate_attachment_metadata().
    173                 require_once ABSPATH . 'wp-admin/includes/admin.php';
     173                require_once ABSPATH . 'wp-admin/includes/image.php';
    174174
    175175                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
    176176
    class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    513513                // Get the content-type.
    514514                $type = array_shift( $headers['content_type'] );
    515515
    516                 /** Include admin functions to get access to wp_tempnam() and wp_handle_sideload() */
    517                 require_once ABSPATH . 'wp-admin/includes/admin.php';
     516                /** Include to get access to wp_tempnam() and wp_handle_sideload() */
     517                require_once ABSPATH . 'wp-admin/includes/file.php';
    518518
    519519                // Save the file.
    520520                $tmpfname = wp_tempnam( $filename );
    class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    703703                        $overrides['action'] = 'wp_handle_mock_upload';
    704704                }
    705705
    706                 /** Include admin functions to get access to wp_handle_upload() */
    707                 require_once ABSPATH . 'wp-admin/includes/admin.php';
     706                /** Include to get access to wp_handle_upload() */
     707                require_once ABSPATH . 'wp-admin/includes/file.php';
    708708
    709709                $file = wp_handle_upload( $files['file'], $overrides );
    710710