[wp-trac] [WordPress Trac] #57386: Add filter to WP_Upgrader::install_package for copy_dir()

WordPress Trac noreply at wordpress.org
Wed Jan 18 00:17:37 UTC 2023


#57386: Add filter to WP_Upgrader::install_package for copy_dir()
------------------------------------+--------------------------
 Reporter:  afragen                 |       Owner:  (none)
     Type:  feature request         |      Status:  reopened
 Priority:  normal                  |   Milestone:  6.2
Component:  Upgrade/Install         |     Version:  trunk
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:  performance
------------------------------------+--------------------------

Comment (by azaozz):

 Replying to [comment:33 costdev]:
 > if someone saw the `upgrader_use_move_dir` hook in...

 But this filter doesn't exist in WP.

 > If Core didn't use `move_dir()` by default, it would still have a toggle
 for whether to use it

 Not exactly. `move_dir()` seems unsafe to use. The problem is not in the
 function itself, and is not in the PHP's `rename()` (although it seems the
 VB bug can easily be corrected there). The problem is that `rename()` may
 trigger a known bug in VirtualBox. So any code that uses PHP's `rename()`
 is potentially unsafe when run in a VirtualBox.

 So instead of adding an unused function to core (which is generally
 unacceptable), the idea is to have `move_dir()` in a plugin. There also
 won't be any need for filters, toggles, etc.

 Then, if a workaround for the VirtualBox bug is found, the `move_dir()`
 function can safely be used in core. At that time a filter may also be
 added to bypass or disable it (if deemed necessary).

 In these terms thinking this ticket can probably be closed now. A new
 ticket for a workaround for the VirtualBox bug seems like a better idea.

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


More information about the wp-trac mailing list