[wp-trac] [WordPress Trac] #57386: Add filter to WP_Upgrader::install_package for copy_dir()
WordPress Trac
noreply at wordpress.org
Fri Jan 6 01:19:53 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 | Focuses: performance
-----------------------------+--------------------------
Comment (by azaozz):
@peterwilsoncc, @afragen, sorry for not being clear enough. Yes, my
suggestion was for a new ticket to be opened that is not related to the
feature plugin. Imho the use cases for having a (permanent) filter can be
discussed better here.
Looking at the PR, couple thoughts:
1. The proposed filter is "binary". The return value can only be
`'move_dir'` or the default. Such binary filters may be better written as
`apply_filters( 'upgrader_use_move_dir', false );` and used with
`add_filter( 'upgrader_use_move_dir', '__return_true' );`. Also perhaps
passing some more context to the filter like `$source,
$remote_destination` would make it eventually more useful, perhaps?
2. Looking at #57375 and the new `move_dir()` function, why would WP need
a filter to use it if it is better/faster, and has been tested
sufficiently? If there still are any stability concerns, perhaps a filter
to revert to the old `copy_dir()` may be needed? However looking at the
patch there, it falls back to `copy_dir()`, so not sure if a filter is
needed at all. Will also comment on #57375.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57386#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list