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

WordPress Trac noreply at wordpress.org
Tue Dec 27 16:39:21 UTC 2022


#57386: Add filter to WP_Upgrader::install_package for copy_dir()
-----------------------------+-----------------------
 Reporter:  afragen          |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  6.2
Component:  Upgrade/Install  |    Version:
 Severity:  normal           |   Keywords:  has-patch
  Focuses:  performance      |
-----------------------------+-----------------------
 `copy_dir()` is a recursive file copy for directories and is used when
 updating plugins, themes, and core.

 There are several tickets related to timeouts and optimization of the
 update process. As part of Rollback #51857, a new function `move_dir()`
 and a new filter #56057 were introduced. This ticket is an improvement
 upon #56057.

 Optimizing the plugin/theme update process can be solved using the
 `move_dir()` function and a filter similar to #56057.

 #57357 was opened to add `move_dir()` to core. This ticket is to add the
 new filter.

 The new filter would easily allow the substitution of `move_dir` for
 `copy_dir` adding more efficiency to the plugin/theme update process by
 having the user add a simple filter. This could improve the efficiency and
 performance for 99+% of users who opt-in and will likely fix #53832,
 #54166, and #34676.


 {{{
 add_filter( 'upgrader_copy_directory', function($callback) {
     return 'move_dir';
 }, 10, 1 );
 }}}

 I believe the use cases are sufficient to merit inclusion to core,
 additionally both of these have been tested rigorously in the Rollback
 PR/feature plugin.

 Once/If the PR is committed I will submit a plugin to dot org allowing
 anyone to activate this feature.

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


More information about the wp-trac mailing list