Make WordPress Core

Opened 7 years ago

Last modified 6 years ago

#43990 assigned enhancement

Use wp_delete_file instead of unlink

Reported by: macbookandrew's profile macbookandrew Owned by:
Milestone: Future Release Priority: low
Severity: normal Version:
Component: Filesystem API Keywords: needs-testing has-patch
Focuses: Cc:

Description

Use wp_delete instead of unlink as much as possible throughout the codebase.

Attachments (1)

43990.patch (6.6 KB) - added by macbookandrew 7 years ago.

Download all attachments as: .zip

Change History (8)

@macbookandrew
7 years ago

#1 @jdgrimes
7 years ago

  • Summary changed from Use wp_delete instead of unlink to Use wp_delete_file instead of unlink

#2 @iandunn
7 years ago

#44014 was marked as a duplicate.

#3 @iandunn
7 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Owner set to iandunn
  • Priority changed from normal to low
  • Status changed from new to accepted
  • Type changed from defect (bug) to enhancement

43990.patch looks pretty good at first glance. wp_delete_file() uses the @ operator when it calls unlink(), so I don't think we need to keep it when calling wp_delete_file().

( I kinda think it shouldn't even be used inside wp_delete_file(), but that's another ticket :) )

#4 @macbookandrew
7 years ago

I wondered about the @ operator but figured I’d leave it since I don’t know why it was there in the first place. 😄

#5 @desrosj
7 years ago

@macbookandrew just for clarity, can you quickly detail why using wp_delete_file() is preferred?

#6 @macbookandrew
7 years ago

@desrosj Basically to standardize on one method for removing files, and also giving the option to use the wp_delete_file filter for every file deletion action.

That and @iandunn’s comment here: https://core.trac.wordpress.org/ticket/43546#comment:57

#7 @iandunn
6 years ago

  • Owner iandunn deleted
  • Status changed from accepted to assigned
Note: See TracTickets for help on using tickets.