[wp-trac] [WordPress Trac] #57557: Switch copy_dir() with move_dir() in WP_Upgrader::install_package

WordPress Trac noreply at wordpress.org
Fri Feb 3 01:55:30 UTC 2023


#57557: Switch copy_dir() with move_dir() in WP_Upgrader::install_package
-----------------------------+-----------------------------
 Reporter:  afragen          |       Owner:  SergeyBiryukov
     Type:  enhancement      |      Status:  accepted
 Priority:  normal           |   Milestone:  6.2
Component:  Upgrade/Install  |     Version:  trunk
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |     Focuses:  performance
-----------------------------+-----------------------------

Comment (by peterwilsoncc):

 @afragen, @costdev and I discussed when to use move or copy and it's a
 little more complicated than a simple switch from one to the other.

 `copy_dir` needs to be used if `WP_Upgrader::install_package()` is called
 with either `clear_working` or `clear_destination` are false.

 `clear_working` retains the source directory for the updated plugin in the
 `upgrades` folder. Core never sets the value to `false` but it can be
 altered via filters or when an extender calls the method directly.

 `clear_destination` can be false in the case of partial updates and the
 files in the `upgrade` directory need to be appended to the existing
 directory. Again, this is not something Core does.

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


More information about the wp-trac mailing list