Upgrade/Install: Fix parameter count in `error` call when an automatic core upgrade fails.

During automatic core upgrades, if installation results in a `WP_Error`, the `error` method is called on the skin with the details.  However, in this case, two parameters are passed to `$skin->error`, but only one is accepted.  This change passes only the running `WP_Error` instance as the sole parameter to `$skin->error`.

Also, this change adds an additional error to `$upgrade_result` before finally being passed to `$skin->error`, indicating that the installation failed.  This adds additional context to the failure.

Props desrosj, sainthkh, devutpol, SergeyBiryukov.
Fixes #53284.
Built from https://develop.svn.wordpress.org/trunk@52539


git-svn-id: http://core.svn.wordpress.org/trunk@52129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
davidbaumwald 2022-01-07 17:55:01 +00:00
parent 10e842a662
commit aeb5d2ef17
2 changed files with 4 additions and 3 deletions

View File

@ -419,9 +419,10 @@ class WP_Automatic_Updater {
return false;
}
// Core doesn't output this, so let's append it so we don't get confused.
// Core doesn't output this, so let's append it, so we don't get confused.
if ( is_wp_error( $upgrade_result ) ) {
$skin->error( __( 'Installation failed.' ), $upgrade_result );
$upgrade_result->add( 'installation_failed', __( 'Installation failed.' ) );
$skin->error( $upgrade_result );
} else {
$skin->feedback( __( 'WordPress updated successfully.' ) );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52538';
$wp_version = '6.0-alpha-52539';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.