- Timestamp:
- 05/16/2020 06:40:52 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-automatic-updater.php
r47550 r47808 144 144 // Only relax the filesystem checks when the update doesn't include new files. 145 145 $allow_relaxed_file_ownership = false; 146 if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {146 if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) { 147 147 $allow_relaxed_file_ownership = true; 148 148 } … … 150 150 // If we can't do an auto core update, we may still be able to email the user. 151 151 if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) { 152 if ( 'core' == $type ) {152 if ( 'core' === $type ) { 153 153 $this->send_core_update_notification_email( $item ); 154 154 } … … 157 157 158 158 // Next up, is this an item we can update? 159 if ( 'core' == $type ) {159 if ( 'core' === $type ) { 160 160 $update = Core_Upgrader::should_update_to_version( $item->current ); 161 161 } else { … … 185 185 186 186 if ( ! $update ) { 187 if ( 'core' == $type ) {187 if ( 'core' === $type ) { 188 188 $this->send_core_update_notification_email( $item ); 189 189 } … … 192 192 193 193 // If it's a core update, are we actually compatible with its requirements? 194 if ( 'core' == $type ) {194 if ( 'core' === $type ) { 195 195 global $wpdb; 196 196 … … 345 345 346 346 $allow_relaxed_file_ownership = false; 347 if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {347 if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) { 348 348 $allow_relaxed_file_ownership = true; 349 349 } … … 368 368 } 369 369 370 if ( 'core' == $type ) { 371 if ( is_wp_error( $upgrade_result ) && ( 'up_to_date' == $upgrade_result->get_error_code() || 'locked' == $upgrade_result->get_error_code() ) ) { 372 // These aren't actual errors, treat it as a skipped-update instead to avoid triggering the post-core update failure routines. 370 if ( 'core' === $type ) { 371 if ( is_wp_error( $upgrade_result ) 372 && ( 'up_to_date' === $upgrade_result->get_error_code() 373 || 'locked' === $upgrade_result->get_error_code() ) 374 ) { 375 // These aren't actual errors, treat it as a skipped-update instead 376 // to avoid triggering the post-core update failure routines. 373 377 return false; 374 378 } … … 627 631 628 632 $next_user_core_update = get_preferred_from_update_core(); 633 629 634 // If the update transient is empty, use the update we just performed. 630 635 if ( ! $next_user_core_update ) { 631 636 $next_user_core_update = $core_update; 632 637 } 633 $newer_version_available = ( 'upgrade' == $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) ); 638 639 $newer_version_available = ( 'upgrade' === $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) ); 634 640 635 641 /** … … 716 722 // Don't show this message if there is a newer version available. 717 723 // Potential for confusion, and also not useful for them to know at this point. 718 if ( 'fail' == $type && ! $newer_version_available ) {724 if ( 'fail' === $type && ! $newer_version_available ) { 719 725 $body .= __( 'We tried but were unable to update your site automatically.' ) . ' '; 720 726 } … … 779 785 $body .= "\n\n" . __( 'The WordPress Team' ) . "\n"; 780 786 781 if ( 'critical' == $type && is_wp_error( $result ) ) {787 if ( 'critical' === $type && is_wp_error( $result ) ) { 782 788 $body .= "\n***\n\n"; 783 789 /* translators: %s: WordPress version. */ … … 788 794 // If we had a rollback and we're still critical, then the rollback failed too. 789 795 // Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc. 790 if ( 'rollback_was_required' == $result->get_error_code() ) {796 if ( 'rollback_was_required' === $result->get_error_code() ) { 791 797 $errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback ); 792 798 } else { … … 798 804 continue; 799 805 } 806 800 807 $error_code = $error->get_error_code(); 801 808 /* translators: %s: Error code. */ 802 809 $body .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code ); 803 if ( 'rollback_was_required' == $error_code ) { 810 811 if ( 'rollback_was_required' === $error_code ) { 804 812 continue; 805 813 } 814 806 815 if ( $error->get_error_message() ) { 807 816 $body .= "\n" . $error->get_error_message(); 808 817 } 818 809 819 $error_data = $error->get_error_data(); 810 820 if ( $error_data ) { … … 812 822 } 813 823 } 824 814 825 $body .= "\n"; 815 826 }
Note: See TracChangeset
for help on using the changeset viewer.