Upgrades: Allow upgrades to proceed when a soft failure occurs on package signatures.

In particular, this allows downgrading from WordPress 5.2 to 5.1.1, if sites wish to opt out of the beta.

Props dd32.
See #46615.


Built from https://develop.svn.wordpress.org/trunk@45046


git-svn-id: http://core.svn.wordpress.org/trunk@44855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-03-27 23:05:54 +00:00
parent d5f198676b
commit 0a4d431e11
2 changed files with 20 additions and 1 deletions

View File

@ -122,6 +122,25 @@ class Core_Upgrader extends WP_Upgrader {
}
$download = $this->download_package( $current->packages->$to_download );
// Allow for signature soft-fail.
// WARNING: This may be removed in the future.
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
// Outout the failure error as a normal feedback, and not as an error:
apply_filters( 'update_feedback', $download->get_error_message() );
// Report this failure back to WordPress.org for debugging purposes.
wp_version_check(
array(
'signature_failure_code' => $download->get_error_code(),
'signature_failure_data' => $download->get_error_data(),
)
);
// Pretend this error didn't happen.
$download = $download->get_error_data( 'softfail-filename' );
}
if ( is_wp_error( $download ) ) {
WP_Upgrader::release_lock( 'core_updater' );
return $download;

View File

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