diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css index 78fe695cb1..0d843cb5bf 100644 --- a/src/wp-admin/css/common.css +++ b/src/wp-admin/css/common.css @@ -1600,6 +1600,19 @@ form.upgrade .hint { margin: -4px 0; } +h2.wp-current-version { + margin-bottom: .3em; +} + +p.update-last-checked { + margin-top: 0; +} + +p.auto-update-status { + margin-top: 2em; + line-height: 1.8; +} + #ajax-loading, .ajax-loading, .ajax-feedback, diff --git a/src/wp-admin/includes/class-core-upgrader.php b/src/wp-admin/includes/class-core-upgrader.php index 6ffb98a7ec..b57a13fd7b 100644 --- a/src/wp-admin/includes/class-core-upgrader.php +++ b/src/wp-admin/includes/class-core-upgrader.php @@ -279,9 +279,9 @@ class Core_Upgrader extends WP_Upgrader { $current_is_development_version = (bool) strpos( $wp_version, '-' ); // Defaults: - $upgrade_dev = get_site_option( 'auto_update_core_dev', true ); - $upgrade_minor = get_site_option( 'auto_update_core_minor', true ); - $upgrade_major = get_site_option( 'auto_update_core_major', false ); + $upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled'; + $upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled'; + $upgrade_major = get_site_option( 'auto_update_core_major', 'unset' ) === 'enabled'; // WP_AUTO_UPDATE_CORE = true (all), 'beta', 'rc', 'minor', false. if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) { diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php index c08e57f6e9..904a76366a 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 automatically:' ); + $message = __( 'You are using a development version of WordPress. You can update to the latest nightly build manually:' ); } else { if ( $current ) { /* translators: %s: WordPress version. */ @@ -127,7 +127,7 @@ function list_core_update( $update ) { } else { $message = sprintf( /* translators: 1: Installed WordPress version number, 2: URL to WordPress release notes, 3: New WordPress version number, including locale if necessary. */ - __( 'You can update from WordPress %1$s to WordPress %3$s automatically:' ), + __( 'You can update from WordPress %1$s to WordPress %3$s manually:' ), $wp_version, $version_url, $version_string @@ -254,7 +254,11 @@ function core_upgrade_preamble() { } if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) { - echo '
'; + echo '
'; printf( /* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */ __( 'Important: Before updating, please back up your database and files. For help with updates, visit the Updating WordPress documentation page.' ), @@ -262,10 +266,6 @@ function core_upgrade_preamble() { __( 'https://wordpress.org/support/article/updating-wordpress/' ) ); echo '
' . $notice_text . '
' . $notice_text . '
'; - _e( 'WordPress auto-update settings updated.' ); - echo '
' . wp_get_auto_update_message() . '
'; + } + } + + $action_url = self_admin_url( 'update-core.php?action=core-major-auto-updates-settings' ); ?> - + +'; @@ -975,15 +1011,20 @@ if ( 'upgrade-core' === $action ) { $last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; } - echo '
'; + echo '
'; /* translators: 1: Date, 2: Time. */ printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a' ), $last_update_check ) ); echo ' ' . __( 'Check again.' ) . ''; echo '
'; if ( current_user_can( 'update_core' ) ) { - core_upgrade_preamble(); core_auto_updates_settings(); + core_upgrade_preamble(); } if ( current_user_can( 'update_plugins' ) ) { list_plugin_updates(); @@ -1158,6 +1199,23 @@ if ( 'upgrade-core' === $action ) { require_once ABSPATH . 'wp-admin/admin-footer.php'; +} elseif ( 'core-major-auto-updates-settings' === $action ) { + $redirect_url = self_admin_url( 'update-core.php' ); + + if ( isset( $_GET['value'] ) ) { + check_admin_referer( 'core-major-auto-updates-nonce' ); + + if ( 'enable' === $_GET['value'] ) { + update_site_option( 'auto_update_core_major', 'enabled' ); + $redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'enabled', $redirect_url ); + } elseif ( 'disable' === $_GET['value'] ) { + update_site_option( 'auto_update_core_major', 'disabled' ); + $redirect_url = add_query_arg( 'core-major-auto-updates-saved', 'disabled', $redirect_url ); + } + } + + wp_redirect( $redirect_url ); + exit; } else { /** * Fires for each custom update action on the WordPress Updates screen.