Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#43757 reviewing enhancement

`WP_REST_Attachments_Controller` includes entire admin includes for a few utility functions

Reported by: lonelyvegan Owned by: SergeyBiryukov
Milestone: 5.0 Priority: normal
Severity: minor Version: trunk
Component: REST API Keywords: has-patch needs-testing
Focuses: Cc:


Looks like https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php uses only a few admin function (wp_handle_upload, wp_generate_attachment_metadata, wp_tempnam, and wp_handle_sideload) but it's requiring the entire admin.php include.

It seems we could just require file.php and image.php from the admin directly instead.

Attachments (2)

43757.diff (1.7 KB) - added by soulseekah 2 months ago.
leaner includes
43757.2.diff (1.5 KB) - added by pratikthink 2 months ago.
added correct sentence for comment

Download all attachments as: .zip

Change History (7)

2 months ago

leaner includes

#1 @soulseekah
2 months ago

  • Keywords has-patch needs-testing added; needs-patch removed

Hey, welcome to Trac! :)

You appear to be very correct in this regard. Attached diff for leaner includes. Tests pass fine.

#2 @lonelyvegan
2 months ago

That's exactly the patch I was going to suggest but was having internet troubles and did get around to submitting it. Looks good to me, but I'm probably much to green to be reviewing patches to core. 😅 👍🏻

#3 @jrf
2 months ago

  • Focuses coding-standards removed

#5 @SergeyBiryukov
2 months ago

  • Milestone changed from Awaiting Review to 5.0
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

2 months ago

added correct sentence for comment

Note: See TracTickets for help on using tickets.