mirror of
https://ghproxy.net/https://github.com/fairpm/fair-plugin.git
synced 2025-09-04 08:50:35 +08:00
unify upgrader_pre_download
hook actions
Signed-off-by: Andy Fragen <andy@thefragens.com>
This commit is contained in:
parent
c9337fd72c
commit
6f8ca915aa
2 changed files with 3 additions and 14 deletions
|
@ -572,13 +572,15 @@ function get_update_data( $did ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Send upgrader_pre_download filter to hook `upgrader_source_selection` during AJAX.
|
||||
* Send upgrader_pre_download filter to hook `upgrader_source_selection` during AJAX
|
||||
* and send to `maybe_add_accept_header()`.
|
||||
*
|
||||
* @param bool $false Whether to bail without returning the package.
|
||||
* Default false.
|
||||
* @return bool
|
||||
*/
|
||||
function upgrader_pre_download( $false ) : bool {
|
||||
add_filter( 'http_request_args', 'FAIR\\Packages\\maybe_add_accept_header', 20, 2 );
|
||||
add_filter( 'upgrader_source_selection', __NAMESPACE__ . '\\rename_source_selection', 10, 3 );
|
||||
return $false;
|
||||
}
|
||||
|
|
|
@ -14,19 +14,6 @@ use FAIR\Packages;
|
|||
*/
|
||||
function bootstrap() {
|
||||
add_action( 'init', __NAMESPACE__ . '\\run' );
|
||||
add_filter( 'upgrader_pre_download', __NAMESPACE__ . '\\upgrader_pre_download', 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Send upgrader_pre_download filter to maybe_add_accept_header().
|
||||
*
|
||||
* @param bool $false Whether to bail without returning the package.
|
||||
* Default false.
|
||||
* @return bool
|
||||
*/
|
||||
function upgrader_pre_download( $false ) : bool {
|
||||
add_filter( 'http_request_args', 'FAIR\\Packages\\maybe_add_accept_header', 20, 2 );
|
||||
return $false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue