Upgrade/Install: Introduce a filter for the result of `WP_Upgrader::install_package()`.

This allows for the capture and usage of error data from the method, to facilitate a potential plugin/theme rollback in the event of an update failure.

Props afragen, dd32.
Fixes #52381.
Built from https://develop.svn.wordpress.org/trunk@50151


git-svn-id: http://core.svn.wordpress.org/trunk@49830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-02-02 17:31:05 +00:00
parent 8a51ab57e0
commit 2cb2651c00
2 changed files with 11 additions and 1 deletions

View File

@ -798,6 +798,16 @@ class WP_Upgrader {
)
);
/**
* Filters the result of WP_Upgrader::install_package().
*
* @since 5.7.0
*
* @param array|WP_Error $result Result from WP_Upgrader::install_package().
* @param array $hook_extra Extra arguments passed to hooked filters.
*/
$result = apply_filters( 'upgrader_install_package_result', $result, $options['hook_extra'] );
$this->skin->set_result( $result );
if ( is_wp_error( $result ) ) {
$this->skin->error( $result );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-alpha-50150';
$wp_version = '5.7-alpha-50151';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.