--- a/wp/wp-admin/update-core.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/update-core.php Fri Sep 05 18:40:08 2025 +0200
@@ -42,7 +42,7 @@
if ( 'en_US' === $update->locale && 'en_US' === get_locale() ) {
$version_string = $update->current;
- } elseif ( 'en_US' === $update->locale && $update->packages->partial && $wp_version == $update->partial_version ) {
+ } elseif ( 'en_US' === $update->locale && $update->packages->partial && $wp_version === $update->partial_version ) {
$updates = get_core_updates();
if ( $updates && 1 === count( $updates ) ) {
// If the only available update is a partial builds, it doesn't need a language-specific version string.
@@ -59,7 +59,7 @@
$message = '';
$form_action = 'update-core.php?action=do-core-upgrade';
- $php_version = phpversion();
+ $php_version = PHP_VERSION;
$mysql_version = $wpdb->db_version();
$show_buttons = true;
@@ -91,7 +91,7 @@
$version_url = sprintf(
/* translators: %s: WordPress version. */
- esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
+ esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
sanitize_title( $update->current )
);
@@ -179,19 +179,18 @@
}
echo '</p>';
- if ( 'en_US' !== $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package != $update->locale ) ) {
+ if ( 'en_US' !== $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package !== $update->locale ) ) {
echo '<p class="hint">' . __( 'This localized version contains both the translation and various other localization fixes.' ) . '</p>';
- } elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
+ } elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() && ( ! $update->packages->partial && $wp_version === $update->partial_version ) ) {
// Partial builds don't need language-specific warnings.
echo '<p class="hint">' . sprintf(
/* translators: %s: WordPress version. */
- __( 'You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ),
+ __( 'You are about to install WordPress %s <strong>in English (US)</strong>. There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ),
'development' !== $update->response ? $update->current : ''
) . '</p>';
}
echo '</form>';
-
}
/**
@@ -242,13 +241,8 @@
* Display upgrade WordPress for downloading latest or upgrading automatically form.
*
* @since 2.7.0
- *
- * @global string $required_php_version The required PHP version string.
- * @global string $required_mysql_version The required MySQL version string.
*/
function core_upgrade_preamble() {
- global $required_php_version, $required_mysql_version;
-
$updates = get_core_updates();
// Include an unmodified $wp_version.
@@ -261,14 +255,19 @@
_e( 'An updated version of WordPress is available.' );
echo '</h2>';
- echo '<div class="notice notice-warning inline"><p>';
- printf(
+ $message = sprintf(
/* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */
__( '<strong>Important:</strong> Before updating, please <a href="%1$s">back up your database and files</a>. For help with updates, visit the <a href="%2$s">Updating WordPress</a> documentation page.' ),
- __( 'https://wordpress.org/support/article/wordpress-backups/' ),
- __( 'https://wordpress.org/support/article/updating-wordpress/' )
+ __( 'https://developer.wordpress.org/advanced-administration/security/backup/' ),
+ __( 'https://wordpress.org/documentation/article/updating-wordpress/' )
);
- echo '</p></div>';
+ wp_admin_notice(
+ $message,
+ array(
+ 'type' => 'warning',
+ 'additional_classes' => array( 'inline' ),
+ )
+ );
} elseif ( $is_development_version ) {
echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>';
} else {
@@ -308,10 +307,22 @@
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 '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>';
+ wp_admin_notice(
+ $notice_text,
+ array(
+ 'type' => 'success',
+ 'dismissible' => true,
+ )
+ );
} elseif ( 'disabled' === $_GET['core-major-auto-updates-saved'] ) {
$notice_text = __( 'WordPress will only receive automatic security and maintenance releases from now on.' );
- echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>';
+ wp_admin_notice(
+ $notice_text,
+ array(
+ 'type' => 'success',
+ 'dismissible' => true,
+ )
+ );
}
}
@@ -402,7 +413,7 @@
_e( 'This site is automatically kept up to date with each new version of WordPress.' );
if ( $can_set_update_option ) {
- echo '<br>';
+ echo '<br />';
printf(
'<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' ),
@@ -413,7 +424,7 @@
_e( 'This site is automatically kept up to date with maintenance and security releases of WordPress only.' );
if ( $can_set_update_option ) {
- echo '<br>';
+ echo '<br />';
printf(
'<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' ),
@@ -535,7 +546,7 @@
$compatible_php = is_php_version_compatible( $requires_php );
if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
- $compat .= '<br>' . __( 'This update does not work with your version of PHP.' ) . ' ';
+ $compat .= '<br />' . __( 'This update does not work with your version of PHP.' ) . ' ';
$compat .= sprintf(
/* translators: %s: URL to Update PHP page. */
__( '<a href="%s">Learn more about updating PHP</a>.' ),
@@ -572,11 +583,13 @@
<td class="check-column">
<?php if ( $compatible_php ) : ?>
<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
- <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text">
+ <label for="<?php echo $checkbox_id; ?>">
+ <span class="screen-reader-text">
<?php
- /* translators: %s: Plugin name. */
+ /* translators: Hidden accessibility text. %s: Plugin name. */
printf( __( 'Select %s' ), $plugin_data->Name );
?>
+ </span>
</label>
<?php endif; ?>
</td>
@@ -591,11 +604,13 @@
$plugin_data->update->new_version
);
- echo ' ' . $details . $compat . $upgrade_notice;
+ echo ' ' . $details . $compat;
if ( in_array( $plugin_file, $auto_updates, true ) ) {
echo $auto_update_notice;
}
+
+ echo $upgrade_notice;
?>
</p></td>
</tr>
@@ -681,12 +696,12 @@
$compat = '';
if ( ! $compatible_wp && ! $compatible_php ) {
- $compat .= '<br>' . __( 'This update does not work with your versions of WordPress and PHP.' ) . ' ';
+ $compat .= '<br />' . __( 'This update does not work with your versions of WordPress and PHP.' ) . ' ';
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
$compat .= sprintf(
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
__( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
- self_admin_url( 'update-core.php' ),
+ esc_url( self_admin_url( 'update-core.php' ) ),
esc_url( wp_get_update_php_url() )
);
@@ -699,7 +714,7 @@
$compat .= sprintf(
/* translators: %s: URL to WordPress Updates screen. */
__( '<a href="%s">Please update WordPress</a>.' ),
- self_admin_url( 'update-core.php' )
+ esc_url( self_admin_url( 'update-core.php' ) )
);
} elseif ( current_user_can( 'update_php' ) ) {
$compat .= sprintf(
@@ -715,16 +730,16 @@
}
}
} elseif ( ! $compatible_wp ) {
- $compat .= '<br>' . __( 'This update does not work with your version of WordPress.' ) . ' ';
+ $compat .= '<br />' . __( 'This update does not work with your version of WordPress.' ) . ' ';
if ( current_user_can( 'update_core' ) ) {
$compat .= sprintf(
/* translators: %s: URL to WordPress Updates screen. */
__( '<a href="%s">Please update WordPress</a>.' ),
- self_admin_url( 'update-core.php' )
+ esc_url( self_admin_url( 'update-core.php' ) )
);
}
} elseif ( ! $compatible_php ) {
- $compat .= '<br>' . __( 'This update does not work with your version of PHP.' ) . ' ';
+ $compat .= '<br />' . __( 'This update does not work with your version of PHP.' ) . ' ';
if ( current_user_can( 'update_php' ) ) {
$compat .= sprintf(
/* translators: %s: URL to Update PHP page. */
@@ -746,11 +761,13 @@
<td class="check-column">
<?php if ( $compatible_wp && $compatible_php ) : ?>
<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
- <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text">
+ <label for="<?php echo $checkbox_id; ?>">
+ <span class="screen-reader-text">
<?php
- /* translators: %s: Theme name. */
+ /* translators: Hidden accessibility text. %s: Theme name. */
printf( __( 'Select %s' ), $theme->display( 'Name' ) );
?>
+ </span>
</label>
<?php endif; ?>
</td>
@@ -817,7 +834,7 @@
}
/**
- * Upgrade WordPress core display.
+ * Upgrades WordPress core display.
*
* @since 2.7.0
*
@@ -844,8 +861,10 @@
return;
}
- // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
- // that it's safe to do so. This only happens when there are no new files to create.
+ /*
+ * Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
+ * that it's safe to do so. This only happens when there are no new files to create.
+ */
$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
?>
@@ -890,7 +909,7 @@
if ( is_wp_error( $result ) ) {
show_message( $result );
- if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) {
+ if ( 'up_to_date' !== $result->get_error_code() && 'locked' !== $result->get_error_code() ) {
show_message( __( 'Installation failed.' ) );
}
echo '</div>';
@@ -917,7 +936,7 @@
?>
</div>
<script type="text/javascript">
- window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
+ window.location = '<?php echo esc_url( self_admin_url( 'about.php?updated' ) ); ?>';
</script>
<?php
}
@@ -1008,18 +1027,37 @@
)
);
- $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/support/article/plugins-themes-auto-updates/">Learn more: Auto-updates documentation</a>' ) . '</p>';
+ $help_sidebar_autoupdates = '<p>' . __( '<a href="https://wordpress.org/documentation/article/plugins-themes-auto-updates/">Documentation on Auto-updates</a>' ) . '</p>';
+}
+
+$help_sidebar_rollback = '';
+
+if ( current_user_can( 'update_themes' ) || current_user_can( 'update_plugins' ) ) {
+ $rollback_help = '<p>' . __( 'This feature will create a temporary backup of a plugin or theme before it is upgraded. This backup is used to restore the plugin or theme back to its previous state if there is an error during the update process.' ) . '</p>';
+
+ $rollback_help .= '<p>' . __( 'On systems with fewer resources, this may lead to server timeouts or resource limits being reached. If you encounter an issue during the update process, please create a support forum topic and reference <strong>Rollback</strong> in the issue title.' ) . '</p>';
+
+ get_current_screen()->add_help_tab(
+ array(
+ 'id' => 'rollback-plugins-themes',
+ 'title' => __( 'Restore Plugin or Theme' ),
+ 'content' => $rollback_help,
+ )
+ );
+
+ $help_sidebar_rollback = '<p>' . __( '<a href="https://developer.wordpress.org/advanced-administration/wordpress/common-errors/">Common Errors</a>' ) . '</p>';
}
get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
- '<p>' . __( '<a href="https://wordpress.org/support/article/dashboard-updates-screen/">Documentation on Updating WordPress</a>' ) . '</p>' .
+ '<p>' . __( '<a href="https://wordpress.org/documentation/article/dashboard-updates-screen/">Documentation on Updating WordPress</a>' ) . '</p>' .
$help_sidebar_autoupdates .
- '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
+ '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>' .
+ $help_sidebar_rollback
);
if ( 'upgrade-core' === $action ) {
- // Force a update check when requested.
+ // Force an update check when requested.
$force_check = ! empty( $_GET['force-check'] );
wp_version_check( array(), $force_check );
@@ -1027,17 +1065,31 @@
?>
<div class="wrap">
<h1><?php _e( 'WordPress Updates' ); ?></h1>
- <p><?php _e( 'Here you can find information about updates, set auto-updates and see what plugins or themes need updating.' ); ?></p>
+ <p><?php _e( 'Updates may take several minutes to complete. If there is no feedback after 5 minutes, or if there are errors please refer to the Help section above.' ); ?></p>
<?php
if ( $upgrade_error ) {
- echo '<div class="error"><p>';
if ( 'themes' === $upgrade_error ) {
- _e( 'Please select one or more themes to update.' );
+ $theme_updates = get_theme_updates();
+ if ( ! empty( $theme_updates ) ) {
+ wp_admin_notice(
+ __( 'Please select one or more themes to update.' ),
+ array(
+ 'additional_classes' => array( 'error' ),
+ )
+ );
+ }
} else {
- _e( 'Please select one or more plugins to update.' );
+ $plugin_updates = get_plugin_updates();
+ if ( ! empty( $plugin_updates ) ) {
+ wp_admin_notice(
+ __( 'Please select one or more plugins to update.' ),
+ array(
+ 'additional_classes' => array( 'error' ),
+ )
+ );
+ }
}
- echo '</p></div>';
}
$last_update_check = false;
@@ -1053,8 +1105,15 @@
echo '</h2>';
echo '<p class="update-last-checked">';
- /* 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 T' ), $last_update_check ) );
+
+ printf(
+ /* translators: 1: Date, 2: Time. */
+ __( 'Last checked on %1$s at %2$s.' ),
+ /* translators: Last update date format. See https://www.php.net/manual/datetime.format.php */
+ date_i18n( __( 'F j, Y' ), $last_update_check ),
+ /* translators: Last update time format. See https://www.php.net/manual/datetime.format.php */
+ date_i18n( __( 'g:i a T' ), $last_update_check )
+ );
echo ' <a href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check again.' ) . '</a>';
echo '</p>';