Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#59761 closed enhancement (fixed)

download_url DocBloc suggests to use unlink() over wp_delete_file()

Reported by: bedas's profile bedas Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.5 Priority: normal
Severity: normal Version: 6.4
Component: HTTP API Keywords: has-patch
Focuses: docs, coding-standards Cc:

Description

The DocBloc of https://developer.wordpress.org/reference/functions/download_url/ suggests to unlink() the file, while according WPCS we should wp_delete_file().

This trac merely is to update the docbloc

Change History (5)

This ticket was mentioned in PR #5586 on WordPress/wordpress-develop by @bedas.


6 months ago
#1

  • Adds reference to wp_delete_file() instead of unlink()

#2 @SergeyBiryukov
6 months ago

Hi there, thanks for the ticket!

Depending on the context, it looks like moving the temporary file to another location might also be common here, so instead of mentioning unlink() or wp_delete_file() specifically, perhaps the DocBlock could just state that the calling function must delete or move the file.

#3 @SergeyBiryukov
6 months ago

  • Milestone changed from Awaiting Review to 6.5

#4 @SergeyBiryukov
6 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 57027:

Docs: Improve documentation for wp_tempnam() and download_url().

Instead of mentioning the unlink() function specifically, the DocBlock should state that the calling function must delete or move the temporary file.

Follow-up to [6779], [12151].

Props bedas.
Fixes #59761.

@SergeyBiryukov commented on PR #5586:


6 months ago
#5

Thanks for the PR! Merged in r57027 with some adjustments per comment:2.

Note: See TracTickets for help on using tickets.