WordPress.org

Make WordPress Core

Ticket #45202: 45202.diff

File 45202.diff, 2.7 KB (added by afragen, 2 years ago)
  • wp-admin/update-core.php

    diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php
    index 570703e5d8..eebac90f11 100644
    a b function core_upgrade_preamble() { 
    177177        $wp_version = get_bloginfo( 'version' );
    178178        $updates    = get_core_updates();
    179179
    180         if ( ! isset( $updates[0]->response ) || 'latest' == $updates[0]->response ) {
     180        if ( ! isset( $updates[0]->response ) || 'latest' === $updates[0]->response ) {
    181181                echo '<h2>';
    182182                _e( 'You have the latest version of WordPress.' );
    183183
    184184                if ( wp_http_supports( array( 'ssl' ) ) ) {
    185185                        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    186                         $upgrader            = new WP_Automatic_Updater;
     186                        $upgrader            = new WP_Automatic_Updater();
    187187                        $future_minor_update = (object) array(
    188188                                'current'       => $wp_version . '.1.next.minor',
    189189                                'version'       => $wp_version . '.1.next.minor',
    function core_upgrade_preamble() { 
    196196                        }
    197197                }
    198198                echo '</h2>';
    199         } else {
     199        }
     200
     201        if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) {
    200202                echo '<div class="notice notice-warning"><p>';
    201203                _e( '<strong>Important:</strong> Before updating, please <a href="https://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="https://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.' );
    202204                echo '</p></div>';
    function core_upgrade_preamble() { 
    206208                echo '</h2>';
    207209        }
    208210
    209         if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) {
     211        if ( isset( $updates[0] ) && 'development' === $updates[0]->response ) {
    210212                require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    211                 $upgrader = new WP_Automatic_Updater;
     213                $upgrader = new WP_Automatic_Updater();
    212214                if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) {
    213215                        echo '<div class="updated inline"><p>';
    214216                        echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' );
    function core_upgrade_preamble() { 
    224226        }
    225227        echo '</ul>';
    226228        // Don't show the maintenance mode notice when we are only showing a single re-install option.
    227         if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {
     229        if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) {
    228230                echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
    229231        } elseif ( ! $updates ) {
    230232                list( $normalized_version ) = explode( '-', $wp_version );