[wp-trac] [WordPress Trac] #61590: Make wp_delete_file return to be compliant both with PHP and WPCS

WordPress Trac noreply at wordpress.org
Sat Jul 13 05:02:03 UTC 2024


#61590: Make wp_delete_file return to be compliant both with PHP and WPCS
-----------------------------------+-----------------------------
 Reporter:  bedas                  |       Owner:  SergeyBiryukov
     Type:  enhancement            |      Status:  closed
 Priority:  normal                 |   Milestone:  6.7
Component:  Filesystem API         |     Version:  trunk
 Severity:  normal                 |  Resolution:  fixed
 Keywords:  2nd-opinion has-patch  |     Focuses:
-----------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"58715" 58715]:
 {{{
 #!CommitTicketReference repository="" revision="58715"
 Filesystem API: Add a return value for `wp_delete_file()`.

 This addresses a discrepancy where using `unlink()` allows for checking if
 it was successful via the return value, but `wp_delete_file()` did not
 have a return value, making it impossible to verify the result without
 doing overhead checks if the file still exists.

 This also brings more consistency with the other `wp_delete_*()`
 functions, specifically:

 * `wp_delete_file_from_directory()`
 * `wp_delete_post()`
 * `wp_delete_post_revision()`
 * `wp_delete_attachment()`
 * `wp_delete_attachment_files()`
 * `wp_delete_comment()`
 * `wp_delete_nav_menu()`
 * `wp_delete_term()`
 * `wp_delete_site()`
 * `wp_delete_user()`

 Includes adding basic unit tests for `wp_delete_file()`.

 Follow-up to [31575].

 Props bedas, debarghyabanerjee, mukesh27, SergeyBiryukov.
 Fixes #61590.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61590#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list