[wp-trac] [WordPress Trac] #58995: Remove individual files from `$_old_files` array when its parent directory is already included

WordPress Trac noreply at wordpress.org
Mon Feb 12 16:52:03 UTC 2024


#58995: Remove individual files from `$_old_files` array when its parent directory
is already included
--------------------------------------+----------------------------
 Reporter:  davidbaumwald             |       Owner:  davidbaumwald
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.5
Component:  Upgrade/Install           |     Version:  6.3
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+----------------------------
Changes (by davidbaumwald):

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


Comment:

 In [changeset:"57598" 57598]:
 {{{
 #!CommitTicketReference repository="" revision="57598"
 Upgrade/Install: Remove unnecessary individual subfiles from `$_old_files`
 array.

 On upgrade, the `$_old_files` array is used to cleanup any files that
 exist in a previous version of core but are no longer present in the
 current version.  Sometimes, an entire directory should be removed.  In
 the past, when a parent directory was included in the array, subfiles were
 also included for good measure.

 However, the code that removes the old files uses
 `$wp_filesystem->delete()` with the `$recursive` parameter set to `true`.
 With this setup, individual subfiles are not required to be individually
 listed when their parent directory is already included in the
 `$_old_files` array.

 This commit removes all individual subfiles from the `$_old_files` array
 when their parent directory is already included.

 Props SergeyBiryukov, mhshohel, pbiron, oglekler.
 Fixes #58995.
 }}}

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


More information about the wp-trac mailing list