Opened 7 years ago
Last modified 6 years ago
#43990 assigned enhancement
Use wp_delete_file instead of unlink
Reported by: | 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)
Change History (8)
#1
@
7 years ago
- Summary changed from Use wp_delete instead of unlink to Use wp_delete_file instead of unlink
#3
@
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
@
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
@
7 years ago
@macbookandrew just for clarity, can you quickly detail why using wp_delete_file()
is preferred?
#6
@
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
#44014 was marked as a duplicate.