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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2020-11-17 20:28:04 +00:00
parent cce65c9baf
commit b456e9c9c8
3 changed files with 16 additions and 38 deletions

View File

@ -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 '<h2>';
_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 '</h2>';
}
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 '<h2 class="response">';
_e( 'An updated version of WordPress is available.' );
echo '</h2>';
@ -266,16 +245,10 @@ function core_upgrade_preamble() {
__( 'https://wordpress.org/support/article/updating-wordpress/' )
);
echo '</p></div>';
}
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 '<div class="updated inline"><p>';
echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' );
echo '</p></div>';
}
} elseif ( isset( $updates[0] ) && 'development' === $updates[0]->response ) {
echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>';
} else {
echo '<h2 class="response">' . __( 'You have the latest version of WordPress.' ) . '</h2>';
}
echo '<ul class="core-updates">';
@ -395,24 +368,28 @@ function core_auto_updates_settings() {
<p class="auto-update-status">
<?php
if ( $upgrade_major ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$updater = new WP_Automatic_Updater();
if ( $updater->is_vcs_checkout( ABSPATH ) ) {
_e( 'This site appears to be under version control. Automatic updates are disabled.' );
} elseif ( $upgrade_major ) {
_e( 'This site is automatically kept up to date with each new version of WordPress.' );
if ( $can_set_update_option ) {
echo '<br>';
printf(
'<a href="%s">%s</a>',
'<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-disable">%s</a>',
wp_nonce_url( add_query_arg( 'value', 'disable', $action_url ), 'core-major-auto-updates-nonce' ),
__( 'Switch to automatic updates for maintenance and security releases only.' )
);
}
} elseif ( $upgrade_minor ) {
_e( 'This site is automatically kept up to date with maintenance and security releases of WordPress.' );
_e( 'This site is automatically kept up to date with maintenance and security releases of WordPress only.' );
if ( $can_set_update_option ) {
echo '<br>';
printf(
'<a href="%s">%s</a>',
'<a href="%s" class="core-auto-update-settings-link core-auto-update-settings-link-enable">%s</a>',
wp_nonce_url( add_query_arg( 'value', 'enable', $action_url ), 'core-major-auto-updates-nonce' ),
__( 'Enable automatic updates for all new versions of WordPress.' )
);

View File

@ -1186,6 +1186,7 @@ function wp_removable_query_args() {
'activated',
'admin_email_remind_later',
'approved',
'core-major-auto-updates-saved',
'deactivate',
'delete_count',
'deleted',

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-beta4-49637';
$wp_version = '5.6-beta4-49638';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.