Upgrade/Install: Add `hook_extra` parameter to the `upgrader_pre_download` filter.
This provides additional context to code running on this hook, including which plugin or theme update will be downloaded. It also brings consistency to this filter with others throughout the upgrade process. Props obliviousharmony, desrosj. Fixes #49686. Built from https://develop.svn.wordpress.org/trunk@48399 git-svn-id: http://core.svn.wordpress.org/trunk@48168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dcdabb5bb3
commit
8381fad76e
|
@ -248,21 +248,22 @@ class WP_Upgrader {
|
|||
* @param string $package The URI of the package. If this is the full path to an
|
||||
* existing local file, it will be returned untouched.
|
||||
* @param bool $check_signatures Whether to validate file signatures. Default false.
|
||||
* @param array $hook_extra Extra arguments to pass to the filter hooks. Default empty array.
|
||||
* @return string|WP_Error The full path to the downloaded package file, or a WP_Error object.
|
||||
*/
|
||||
public function download_package( $package, $check_signatures = false ) {
|
||||
|
||||
public function download_package( $package, $check_signatures = false, $hook_extra = array() ) {
|
||||
/**
|
||||
* Filters whether to return the package.
|
||||
*
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @param bool $reply Whether to bail without returning the package.
|
||||
* Default false.
|
||||
* @param string $package The package file name.
|
||||
* @param WP_Upgrader $this The WP_Upgrader instance.
|
||||
* @param bool $reply Whether to bail without returning the package.
|
||||
* Default false.
|
||||
* @param string $package The package file name.
|
||||
* @param WP_Upgrader $this The WP_Upgrader instance.
|
||||
* @param array $hook_extra Extra arguments passed to hooked filters.
|
||||
*/
|
||||
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
|
||||
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this, $hook_extra );
|
||||
if ( false !== $reply ) {
|
||||
return $reply;
|
||||
}
|
||||
|
@ -737,7 +738,7 @@ class WP_Upgrader {
|
|||
* Download the package (Note, This just returns the filename
|
||||
* of the file if the package is a local file)
|
||||
*/
|
||||
$download = $this->download_package( $options['package'], true );
|
||||
$download = $this->download_package( $options['package'], true, $options['hook_extra'] );
|
||||
|
||||
// Allow for signature soft-fail.
|
||||
// WARNING: This may be removed in the future.
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48398';
|
||||
$wp_version = '5.5-alpha-48399';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue