Summery Summery
Display upgrade WordPress for downloading latest or upgrading automatically form.
Syntax Syntax
Source Source
File: wp-admin/update-core.php
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 '<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, '>' ) ) { echo '<div class="notice notice-warning"><p>'; printf( /* 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/' ) ); echo '</p></div>'; echo '<h2 class="response">'; _e( 'An updated version of WordPress is available.' ); echo '</h2>'; } 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>'; } } echo '<ul class="core-updates">'; foreach ( (array) $updates as $update ) { echo '<li>'; list_core_update( $update ); echo '</li>'; } echo '</ul>'; // Don't show the maintenance mode notice when we are only showing a single re-install option. if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) { echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>'; } elseif ( ! $updates ) { list( $normalized_version ) = explode( '-', $wp_version ); echo '<p>' . sprintf( /* translators: 1: URL to About screen, 2: WordPress version. */ __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>'; } dismissed_updates(); }
Advertisement
Changelog Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |