diff -r 34716fd837a4 -r be944660c56a wp/wp-admin/update-core.php --- a/wp/wp-admin/update-core.php Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-admin/update-core.php Wed Sep 21 18:19:35 2022 +0200 @@ -38,7 +38,7 @@ static $first_pass = true; $wp_version = get_bloginfo( 'version' ); - $version_string = sprintf( '%s–%s', $update->current, $update->locale ); + $version_string = sprintf( '%s–%s', $update->current, get_locale() ); if ( 'en_US' === $update->locale && 'en_US' === get_locale() ) { $version_string = $update->current; @@ -54,18 +54,30 @@ if ( ! isset( $update->response ) || 'latest' === $update->response ) { $current = true; } - $submit = __( 'Update Now' ); + + $message = ''; $form_action = 'update-core.php?action=do-core-upgrade'; $php_version = phpversion(); $mysql_version = $wpdb->db_version(); $show_buttons = true; + + // Nightly build versions have two hyphens and a commit number. + if ( preg_match( '/-\w+-\d+/', $update->current ) ) { + // Retrieve the major version number. + preg_match( '/^\d+.\d+/', $update->current, $update_major ); + /* translators: %s: WordPress version. */ + $submit = sprintf( __( 'Update to latest %s nightly' ), $update_major[0] ); + } else { + /* translators: %s: WordPress version. */ + $submit = sprintf( __( 'Update to version %s' ), $version_string ); + } + if ( 'development' === $update->response ) { - $message = __( 'You are using a development version of WordPress. You can update to the latest nightly build automatically:' ); + $message = __( 'You can update to the latest nightly build manually:' ); } else { if ( $current ) { /* translators: %s: WordPress version. */ - $message = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string ); - $submit = __( 'Re-install Now' ); + $submit = sprintf( __( 'Re-install version %s' ), $version_string ); $form_action = 'update-core.php?action=do-core-reinstall'; } else { $php_compat = version_compare( $php_version, $update->php_version, '>=' ); @@ -124,12 +136,14 @@ ); } else { $message = sprintf( - /* translators: 1: URL to WordPress release notes, 2: WordPress version number including locale if necessary. */ - __( 'You can update to WordPress %2$s automatically:' ), + /* 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 manually:' ), + $wp_version, $version_url, $version_string ); } + if ( ! $mysql_compat || ! $php_compat ) { $show_buttons = false; } @@ -139,11 +153,13 @@ echo '
'; echo $message; echo '
'; + echo ''; } @@ -221,32 +239,19 @@ function core_upgrade_preamble() { global $required_php_version, $required_mysql_version; - $wp_version = get_bloginfo( 'version' ); - $updates = get_core_updates(); - - if ( ! isset( $updates[0]->response ) || 'latest' === $updates[0]->response ) { - 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.' ), @@ -254,20 +259,10 @@ __( 'https://wordpress.org/support/article/updating-wordpress/' ) ); echo '
'; - echo '' . __( 'BETA TESTERS:' ) . ' ' . __( 'This site is set up to install updates of future beta versions automatically.' ); - echo '
' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '
'; @@ -289,10 +285,155 @@ $normalized_version ) . ''; } + dismissed_updates(); } /** + * Display WordPress auto-updates settings. + * + * @since 5.6.0 + */ +function core_auto_updates_settings() { + if ( isset( $_GET['core-major-auto-updates-saved'] ) ) { + if ( 'enabled' === $_GET['core-major-auto-updates-saved'] ) { + $notice_text = __( 'Automatic updates for all WordPress versions have been enabled. Thank you!' ); + echo '' . $notice_text . '
' . $notice_text . '
' . wp_get_auto_update_message() . '
'; + } + } + + $action_url = self_admin_url( 'update-core.php?action=core-major-auto-updates-settings' ); + ?> + +
+ 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 '
';
+ printf(
+ '%s',
+ 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 only.' );
+
+ if ( $can_set_update_option ) {
+ echo '
';
+ printf(
+ '%s',
+ wp_nonce_url( add_query_arg( 'value', 'enable', $action_url ), 'core-major-auto-updates-nonce' ),
+ __( 'Enable automatic updates for all new versions of WordPress.' )
+ );
+ }
+ } else {
+ _e( 'This site will not receive automatic updates for new versions of WordPress.' );
+ }
+ ?>
+