Make WordPress Core

Opened 13 years ago

Closed 9 years ago

#24603 closed enhancement (fixed)

Introduce pre_move_uploaded_file filter to allow pre-processing of uploaded files

Reported by: ryan Owned by: DrewAPicture
Priority: normal Milestone: 4.9
Component: Upload Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

This is handy for use in file replication plugins. We've been using this on wordpress.com for awhile for just that purpose.

Attachments (5)

24603.diff (961 bytes ) - added by ryan 13 years ago.
24603.patch (872 bytes ) - added by Mte90 10 years ago.
refreshed patch
24603.2.patch (1.3 KB ) - added by Mte90 10 years ago.
working refreshed patch
24603.3.patch (1.5 KB ) - added by Mte90 10 years ago.
added docs
24603.2.diff (2.3 KB ) - added by DrewAPicture 9 years ago.

Download all attachments as: .zip

Change History (14)

@ryan
13 years ago

#1 @chriscct7
11 years ago

  • Keywords needs-refresh needs-docs added

@Mte90
10 years ago

refreshed patch

@Mte90
10 years ago

working refreshed patch

#2 @Mte90
10 years ago

  • Keywords dev-feedback added; needs-refresh removed

Ignore the 24603.patch this is a wrong testing patch, the real refreshed patch is 24603.2.patch.

#3 @Mte90
10 years ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #docs by morganestes. View the logs.


10 years ago

#5 follow-up: @johnbillion
10 years ago

  • Keywords dev-feedback removed

@Mte90 Can you add a docblock for the new filter please?

@Mte90
10 years ago

added docs

#6 in reply to: ↑ 5 @Mte90
10 years ago

  • Keywords needs-docs removed

Replying to johnbillion:

@Mte90 Can you add a docblock for the new filter please?

Done, I don't know if I written in the best way.

This ticket was mentioned in Slack in #core by drew. View the logs.


9 years ago

#8 @DrewAPicture
9 years ago

  • Milestone Awaiting Review4.9

@Mte90 Updated patch looks pretty good. There's just a couple things I wanted to note that I'll go ahead and fix on commit:

  • There should be a space between the DocBlock summary and description
  • In the case of "real" values like null we typically assign "pseudo-variables" in the DocBlock so as to best illustrate what the value to represents. In this case, we'll probably just reuse $move_new_file

@DrewAPicture
9 years ago

#9 @DrewAPicture
9 years ago

  • Owner set to DrewAPicture
  • Resolutionfixed
  • Status newclosed

In 41258:

Filesystem: Introduce the pre_move_uploaded_file filter.

Passing a non-null value to the filter will prevent the uploaded file from being moved to the uploads directory for any of the functions leveraging _wp_handle_upload(), such as wp_handle_upload() or wp_handle_sideload().

Error reporting related to the file being moved will also be skipped.

Props ryan, Mte90.
Fixes #24603.

Note: See TracTickets for help on using tickets.