Make WordPress Core

Changeset 50762


Ignore:
Timestamp:
04/16/2021 11:59:14 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp-admin/includes/class-wp-automatic-updater.php.

Includes minor code layout fixes for better readability.

See #52627.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-automatic-updater.php

    r50759 r50762  
    152152
    153153        // If we can't do an auto core update, we may still be able to email the user.
    154         if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) {
     154        if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership )
     155            || $this->is_vcs_checkout( $context )
     156        ) {
    155157            if ( 'core' === $type ) {
    156158                $this->send_core_update_notification_email( $item );
     
    257259        if ( $notified
    258260            && get_site_option( 'admin_email' ) === $notified['email']
    259             && $notified['version'] == $item->current
     261            && $notified['version'] === $item->current
    260262        ) {
    261263            return false;
     
    634636            && 'fail' === $notified['type']
    635637            && get_site_option( 'admin_email' ) === $notified['email']
    636             && $notified['version'] == $core_update->current
     638            && $notified['version'] === $core_update->current
    637639        ) {
    638640            $send = false;
     
    683685        }
    684686
    685         $newer_version_available = ( 'upgrade' === $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) );
     687        if ( 'upgrade' === $next_user_core_update->response
     688            && version_compare( $next_user_core_update->version, $core_update->version, '>' )
     689        ) {
     690            $newer_version_available = true;
     691        } else {
     692            $newer_version_available = false;
     693        }
    686694
    687695        /**
     
    11901198                    } else {
    11911199                        $body[] = sprintf(
    1192                              /* translators: 1: Theme name, 2: Version number. */
     1200                            /* translators: 1: Theme name, 2: Version number. */
    11931201                            __( '- %1$s version %2$s' ),
    11941202                            $item->name,
     
    12811289        if ( isset( $this->update_results['core'] ) ) {
    12821290            $result = $this->update_results['core'][0];
     1291
    12831292            if ( $result->result && ! is_wp_error( $result->result ) ) {
    12841293                /* translators: %s: WordPress version. */
     
    12891298                $failures++;
    12901299            }
     1300
    12911301            $body[] = '';
    12921302        }
     
    12971307                continue;
    12981308            }
     1309
    12991310            $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
     1311
    13001312            if ( $success_items ) {
    13011313                $messages = array(
     
    13111323                }
    13121324            }
    1313             if ( $success_items != $this->update_results[ $type ] ) {
     1325
     1326            if ( $success_items !== $this->update_results[ $type ] ) {
    13141327                // Failed updates.
    13151328                $messages = array(
     
    13201333
    13211334                $body[] = $messages[ $type ];
     1335
    13221336                foreach ( $this->update_results[ $type ] as $item ) {
    13231337                    if ( ! $item->result || is_wp_error( $item->result ) ) {
     
    13281342                }
    13291343            }
     1344
    13301345            $body[] = '';
    13311346        }
    13321347
    13331348        $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
     1349
    13341350        if ( $failures ) {
    13351351            $body[] = trim(
     
    13681384                continue;
    13691385            }
     1386
    13701387            foreach ( $this->update_results[ $type ] as $update ) {
    13711388                $body[] = $update->name;
    13721389                $body[] = str_repeat( '-', strlen( $update->name ) );
     1390
    13731391                foreach ( $update->messages as $message ) {
    13741392                    $body[] = '  ' . html_entity_decode( str_replace( '…', '...', $message ) );
    13751393                }
     1394
    13761395                if ( is_wp_error( $update->result ) ) {
    13771396                    $results = array( 'update' => $update->result );
     1397
    13781398                    // If we rolled back, we want to know an error that occurred then too.
    13791399                    if ( 'rollback_was_required' === $update->result->get_error_code() ) {
    13801400                        $results = (array) $update->result->get_error_data();
    13811401                    }
     1402
    13821403                    foreach ( $results as $result_type => $result ) {
    13831404                        if ( ! is_wp_error( $result ) ) {
     
    13981419                    }
    13991420                }
     1421
    14001422                $body[] = '';
    14011423            }
Note: See TracChangeset for help on using the changeset viewer.