WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 2 months ago

#39553 new enhancement

Use REST API endpoints for Plupload backend

Reported by: rmccue Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: Media Keywords: has-patch
Focuses: rest-api Cc:

Description

async-upload.php currently handles all our backend uploading needs. However, with the new POST /wp/v2/media endpoint in the REST API, we no longer need a specialised API.

I had a quick (30 min) go at converting this, and it actually worked out pretty well, which is crazy. There are sure to be a tonne of backwards compatibility concerns to tackle here (especially around the custom parameters that can be passed along), but I'm confident we can tackle them.

Working proof-of-concept patch attached. This changes both the Media Library uploader (wp-plupload.js) and media-new.php (media_upload_form/plupload/handlers.js).

Attachments (1)

39553.diff (6.4 KB) - added by rmccue 5 years ago.
Early POC at conversion

Download all attachments as: .zip

Change History (20)

@rmccue
5 years ago

Early POC at conversion

#1 @dd32
5 years ago

It'd be great if we could enable the Plupload chunking of larger files at the same time here - I know that dramatically increases the amount of work, but would be a welcome addition by many, and would be a good enough reason to break some of the BC concerns in the API IMHO.

#2 @rmccue
5 years ago

Chunking could work, but we need to work out how that looks in a REST context. (That is, design the endpoint first, then make Plupload work with it.) My concern would be that it's a use case that only the admin can use, which wouldn't be great, but if we can design it in an admin-agnostic way, I'm all for adding it.

#3 @rmccue
5 years ago

For reference, S3's API has multi-part support, however this is run a little differently.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


5 years ago

This ticket was mentioned in Slack in #core-media by rmccue. View the logs.


5 years ago

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


5 years ago

This ticket was mentioned in Slack in #core-restapi by rmccue. View the logs.


5 years ago

#8 @rmccue
5 years ago

Split the chunked upload enhancement out to #40410; we should do it, but it shouldn't hold up the JS changes, which lay the groundwork for adding this later.

This ticket was mentioned in Slack in #core-restapi by rmccue. View the logs.


5 years ago

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


5 years ago

#11 @joemcgill
5 years ago

  • Milestone changed from 4.8 to Future Release

Punting based on feedback from @rmccue.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


4 years ago

#13 @spacedmonkey
3 years ago

This ticket looks good. Any chance of getting it merged? @joemcgill ?

This ticket was mentioned in Slack in #core-media by spacedmonkey. View the logs.


2 years ago

This ticket was mentioned in Slack in #core-media by spacedmonkey. View the logs.


6 months ago

#17 @antpb
6 months ago

  • Milestone changed from Future Release to 5.9

Moving into 5.9 for consideration. This ticket will need a fresh review and testing to find any edge cases. Like the description of this issue states, it's a little suspicious that this fits so well, we need to be conscious of any backcompat issues that may come up.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


2 months ago

#19 @antpb
2 months ago

  • Milestone changed from 5.9 to Future Release

Considering the high risk of backcompat issues and remaining time before 5.9 (December release) it was discussed in the Media meeting that this should probably wait one more release.

https://wpdirectory.net/search/01FG9GYEHNZPSNEBEGWATKNNM0

Note: See TracTickets for help on using tickets.