From 2cb2651c0085423e72dd323988f5b26844463b46 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 2 Feb 2021 17:31:05 +0000 Subject: [PATCH] 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 --- wp-admin/includes/class-wp-upgrader.php | 10 ++++++++++ wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 3017b4851d..f35dc7babc 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 57090f1b66..9a839b0560 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.