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

WordPress Trac noreply at wordpress.org
Wed Jan 11 15:28:18 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):

 Only including `move_dir()` in a Canonical plugin would cause a problem if
 someone saw the `upgrader_use_move_dir` hook in source/DevHub and decided
 to use it.

 If Core didn't use `move_dir()` by default, it would still have a toggle
 for whether to use it, suggesting that the function should be available.
 If it isn't available, an opt-in would then be an opt-in to a fatal error.

 The only other alternative I see at the moment is:

 {{{#!php
 <?php
 if ( function_exists( 'move_dir' ) && apply_filters(
 'upgrader_use_move_dir' ) ) {}
 }}}
 Which, while simple, doesn't ''feel'' like the right approach. We're not
 trying to allow a custom implementation of directory moves at this
 location, but rather an opt-in to a more performant Core implementation.

 Curious to hear others' thoughts on this.

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


More information about the wp-trac mailing list