WordPress.org

Make WordPress Core

Changeset 45046


Ignore:
Timestamp:
03/27/2019 11:05:00 PM (9 months ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-core-upgrader.php

    r43571 r45046  
    123123
    124124        $download = $this->download_package( $current->packages->$to_download );
     125
     126        // Allow for signature soft-fail.
     127        // WARNING: This may be removed in the future.
     128        if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
     129            // Outout the failure error as a normal feedback, and not as an error:
     130            apply_filters( 'update_feedback', $download->get_error_message() );
     131
     132            // Report this failure back to WordPress.org for debugging purposes.
     133            wp_version_check(
     134                array(
     135                    'signature_failure_code' => $download->get_error_code(),
     136                    'signature_failure_data' => $download->get_error_data(),
     137                )
     138            );
     139
     140            // Pretend this error didn't happen.
     141            $download = $download->get_error_data( 'softfail-filename' );
     142        }
     143
    125144        if ( is_wp_error( $download ) ) {
    126145            WP_Upgrader::release_lock( 'core_updater' );
Note: See TracChangeset for help on using the changeset viewer.