[wp-trac] [WordPress Trac] #57375: Add move_dir() function

WordPress Trac noreply at wordpress.org
Wed Feb 1 01:05:11 UTC 2023


#57375: Add move_dir() function
--------------------------------------+--------------------------
 Reporter:  afragen                   |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  6.2
Component:  Filesystem API            |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+--------------------------

Comment (by peterwilsoncc):

 I've just added what I hope will be a final review on the
 [https://github.com/WordPress/wordpress-develop/pull/3909 linked PR #3909
 updating the filesystem classes for consistency].

 I think this is in great shape for inclusion in core.

 Discussing this with @azaozz, for 6.2 we'd like to limit the use of
 `move_dir()` to plugins and themes only. The Core updater ought to retain
 its current behavior.

 This logic for this is simple: if the theme or plugin updater gets broken
 then it can be fixed by pushing out a minor update of WordPress. If the
 core updater gets broken then that's not so much of an option.

 PR#3909 doesn't include implementation but I think @afragen has a pr for
 that around somewhere.

 Manually testing PR#3909 with the following diff applied worked as
 expected on Chassis per my notes from the other week.

 {{{#!diff

 diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-
 admin/includes/class-wp-upgrader.php
 index c1d65972c8..a887c967b9 100644
 --- a/src/wp-admin/includes/class-wp-upgrader.php
 +++ b/src/wp-admin/includes/class-wp-upgrader.php
 @@ -594,7 +594,7 @@ class WP_Upgrader {
                 }

                 // Copy new version of item into place.
 -               $result = copy_dir( $source, $remote_destination );
 +               $result = move_dir( $source, $remote_destination, true );

                 // Clear the working folder?
                 if ( $args['clear_working'] ) {

 }}}

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


More information about the wp-trac mailing list