Make WordPress Core

Changeset 49638


Ignore:
Timestamp:
11/17/2020 08:26:32 PM (3 years ago)
Author:
helen
Message:

Upgrade/Install: Consistent layout and accurate messages on the update screen.

  • Clarifies that if you are on maintenance/security auto-updates that you are only on those and therefore there are more options available.
  • Adds a message if a version control system has been detected, as automatic updates are disabled in that case.
  • Ensures only one heading between update available, you are on a dev version, and you are on latest appears at any given time, falling back to you are on latest if something strange happens with the returned update data.
  • Removes some older strings related to auto-updates, which greatly simplifies the above.
  • Strips the core-major-auto-updates-saved query arg from the URL, as it is related to a dismissible notice.

Props audrasjb, pbiron, helen.
Fixes #51742.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update-core.php

    r49631 r49638  
    6363
    6464    if ( 'development' === $update->response ) {
    65         $message = __( 'You are using a development version of WordPress. You can update to the latest nightly build manually:' );
     65        $message = __( 'You can update to the latest nightly build manually:' );
    6666    } else {
    6767        if ( $current ) {
     
    233233    $updates    = get_core_updates();
    234234
    235     if ( ! isset( $updates[0]->response ) || 'latest' === $updates[0]->response ) {
    236         echo '<h2>';
    237         _e( 'You have the latest version of WordPress.' );
    238 
    239         if ( wp_http_supports( array( 'ssl' ) ) ) {
    240             require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    241             $upgrader            = new WP_Automatic_Updater;
    242             $future_minor_update = (object) array(
    243                 'current'       => $wp_version . '.1.next.minor',
    244                 'version'       => $wp_version . '.1.next.minor',
    245                 'php_version'   => $required_php_version,
    246                 'mysql_version' => $required_mysql_version,
    247             );
    248             $should_auto_update  = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
    249             if ( $should_auto_update ) {
    250                 echo ' ' . __( 'Future security updates will be applied automatically.' );
    251             }
    252         }
    253         echo '</h2>';
    254     }
    255 
    256     if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) {
     235    if ( isset( $updates[0] ) && isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) {
    257236        echo '<h2 class="response">';
    258237        _e( 'An updated version of WordPress is available.' );
     
    267246        );
    268247        echo '</p></div>';
    269     }
    270 
    271     if ( isset( $updates[0] ) && 'development' === $updates[0]->response ) {
    272         require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    273         $upgrader = new WP_Automatic_Updater;
    274         if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) {
    275             echo '<div class="updated inline"><p>';
    276             echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' );
    277             echo '</p></div>';
    278         }
     248    } elseif ( isset( $updates[0] ) && 'development' === $updates[0]->response ) {
     249        echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>';
     250    } else {
     251        echo '<h2 class="response">' . __( 'You have the latest version of WordPress.' ) . '</h2>';
    279252    }
    280253
     
    396369    <p class="auto-update-status">
    397370        <?php
    398         if ( $upgrade_major ) {
     371        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     372        $updater = new WP_Automatic_Updater();
     373        if ( $updater->is_vcs_checkout( ABSPATH ) ) {
     374            _e( 'This site appears to be under version control. Automatic updates are disabled.' );
     375        } elseif ( $upgrade_major ) {
    399376            _e( 'This site is automatically kept up to date with each new version of WordPress.' );
    400377
     
    402379                echo '<br>';
    403380                printf(
    404                     '<a href="%s">%s</a>',
     381                    '<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-disable">%s</a>',
    405382                    wp_nonce_url( add_query_arg( 'value', 'disable', $action_url ), 'core-major-auto-updates-nonce' ),
    406383                    __( 'Switch to automatic updates for maintenance and security releases only.' )
     
    408385            }
    409386        } elseif ( $upgrade_minor ) {
    410             _e( 'This site is automatically kept up to date with maintenance and security releases of WordPress.' );
     387            _e( 'This site is automatically kept up to date with maintenance and security releases of WordPress only.' );
    411388
    412389            if ( $can_set_update_option ) {
    413390                echo '<br>';
    414391                printf(
    415                     '<a href="%s">%s</a>',
     392                    '<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-enable">%s</a>',
    416393                    wp_nonce_url( add_query_arg( 'value', 'enable', $action_url ), 'core-major-auto-updates-nonce' ),
    417394                    __( 'Enable automatic updates for all new versions of WordPress.' )
  • trunk/src/wp-includes/functions.php

    r49629 r49638  
    11871187        'admin_email_remind_later',
    11881188        'approved',
     1189        'core-major-auto-updates-saved',
    11891190        'deactivate',
    11901191        'delete_count',
Note: See TracChangeset for help on using the changeset viewer.