From 8372bbdfa5141e7ed1d0d0854d4c6dc2dab183df Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Tue, 17 Nov 2020 20:26:32 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@49638 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/update-core.php | 51 ++++++++++------------------------- src/wp-includes/functions.php | 1 + 2 files changed, 15 insertions(+), 37 deletions(-) diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php index 9068fedc78..47f4b6ae52 100644 --- a/src/wp-admin/update-core.php +++ b/src/wp-admin/update-core.php @@ -62,7 +62,7 @@ function list_core_update( $update ) { $show_buttons = true; if ( 'development' === $update->response ) { - $message = __( 'You are using a development version of WordPress. You can update to the latest nightly build manually:' ); + $message = __( 'You can update to the latest nightly build manually:' ); } else { if ( $current ) { /* translators: %s: WordPress version. */ @@ -232,28 +232,7 @@ function core_upgrade_preamble() { $wp_version = get_bloginfo( 'version' ); $updates = get_core_updates(); - if ( ! isset( $updates[0]->response ) || 'latest' === $updates[0]->response ) { - echo '

'; - _e( 'You have the latest version of WordPress.' ); - - if ( wp_http_supports( array( 'ssl' ) ) ) { - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; - $upgrader = new WP_Automatic_Updater; - $future_minor_update = (object) array( - 'current' => $wp_version . '.1.next.minor', - 'version' => $wp_version . '.1.next.minor', - 'php_version' => $required_php_version, - 'mysql_version' => $required_mysql_version, - ); - $should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH ); - if ( $should_auto_update ) { - echo ' ' . __( 'Future security updates will be applied automatically.' ); - } - } - echo '

'; - } - - if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { + if ( isset( $updates[0] ) && isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { echo '

'; _e( 'An updated version of WordPress is available.' ); echo '

'; @@ -266,16 +245,10 @@ function core_upgrade_preamble() { __( 'https://wordpress.org/support/article/updating-wordpress/' ) ); echo '

'; - } - - if ( isset( $updates[0] ) && 'development' === $updates[0]->response ) { - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; - $upgrader = new WP_Automatic_Updater; - if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) { - echo '

'; - echo '' . __( 'BETA TESTERS:' ) . ' ' . __( 'This site is set up to install updates of future beta versions automatically.' ); - echo '

'; - } + } elseif ( isset( $updates[0] ) && 'development' === $updates[0]->response ) { + echo '

' . __( 'You are using a development version of WordPress.' ) . '

'; + } else { + echo '

' . __( 'You have the latest version of WordPress.' ) . '

'; } echo '