[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:51:00 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 costdev):

 To check if replacing `copy_dir()` with `move_dir()` in
 `WP_Upgrader::install_package()` produced any issues on VirtualBox, I
 installed the Faster Updates plugin and tested on Chassis (VirtualBox
 6.1). The full results can be found
 [https://docs.google.com/spreadsheets/d/1tlwxKtU14mpDaiWBJ7XKc9lpJfTILX_E5KoZ8l2KmJ0/edit?usp=sharing
 here].

 -----

 Highlights:
 - No errors upon activation.
 - No errors when navigating settings pages.
 - The plugin's filter callback containing `shell_exec()` in case the
 VirtualBox bug was encountered was not needed. All worked well while it
 was commented out.

 Notes:
 - The slower speeds are always less than a second difference.
 - The times are based on how fast my finger is at syncing the start/end of
 the updates with my phone's stopwatch.
   - For small differences, this may provide false positives/negatives, so
 consider a margin of error.
   - For large differences, the average plugin improvement is 32%. It's
 highly unlikely my finger is ''that'' slow.
   - Consider the average click/tap time of ~200ms as a margin of error.

 -----

 This appears to confirm my findings that `rename()` itself is not an issue
 with VirtualBox, but that a sequence of `rename( A, B )` -> `rename( C, A
 )` -> `unlink( B )` doesn't give VirtualBox's cache a chance to clear, and
 produces the bug. This sequence is not used by
 `WP_Upgrader::install_package()`, and was only part of the Rollback
 feature plugin. IMHO, it's not very likely that extenders would use this
 sequence.

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


More information about the wp-trac mailing list