Ticket #33932: patch.6.diff
File patch.6.diff, 3.8 KB (added by , 9 years ago) |
---|
-
wp-admin/includes/class-wp-upgrader.php
3461 3461 */ 3462 3462 protected function send_debug_email() { 3463 3463 $update_count = 0; 3464 foreach ( $this->update_results as $type => $updates ) 3464 $update_results = $this->update_results; 3465 foreach ( $update_results as $type => $updates ) 3465 3466 $update_count += count( $updates ); 3466 3467 3467 3468 $body = array(); … … 3470 3471 $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) ); 3471 3472 3472 3473 // Core 3473 if ( isset( $ this->update_results['core'] ) ) {3474 $result = $ this->update_results['core'][0];3474 if ( isset( $update_results['core'] ) ) { 3475 $result = $update_results['core'][0]; 3475 3476 if ( $result->result && ! is_wp_error( $result->result ) ) { 3476 3477 $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name ); 3477 3478 } else { … … 3483 3484 3484 3485 // Plugins, Themes, Translations 3485 3486 foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) { 3486 if ( ! isset( $this->update_results[ $type ] ) ) 3487 continue; 3488 $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) ); 3487 3488 /** 3489 * Filter to disable notification emails on plugins/themes/translation. 3490 * 3491 * By default, administrators are notified when the update offer received 3492 * from WordPress.org sets a particular flag. This allows some discretion 3493 * in if and when to notify. This can be used to disabe automatic 3494 * update notifications. 3495 * 3496 * This filter is only evaluated once per update 3497 *. 3498 * 3499 * @since 4.6.0 3500 * 3501 * @param bool $notify Whether the site administrator is notified. 3502 * @param string $type The type of update (plugin, theme, translation). 3503 * @param object $this WP_Automatic_Updater instance 3504 */ 3505 if ( ! apply_filters( 'send_update_notification_email', true, $type, $this ) ) { 3506 if ( isset( $update_results[ $type ] ) ) { 3507 unset( $update_results[ $type ] ); 3508 } 3509 } 3510 3511 if ( ! isset( $update_results[ $type ] ) ) 3512 continue; 3513 3514 $success_items = wp_list_filter( $update_results[ $type ], array( 'result' => true ) ); 3489 3515 if ( $success_items ) { 3490 3516 $messages = array( 3491 3517 'plugin' => __( 'The following plugins were successfully updated:' ), … … 3498 3524 $body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name ); 3499 3525 } 3500 3526 } 3501 if ( $success_items != $ this->update_results[ $type ] ) {3527 if ( $success_items != $update_results[ $type ] ) { 3502 3528 // Failed updates 3503 3529 $messages = array( 3504 3530 'plugin' => __( 'The following plugins failed to update:' ), … … 3507 3533 ); 3508 3534 3509 3535 $body[] = $messages[ $type ]; 3510 foreach ( $ this->update_results[ $type ] as $item ) {3536 foreach ( $update_results[ $type ] as $item ) { 3511 3537 if ( ! $item->result || is_wp_error( $item->result ) ) { 3512 3538 $body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name ); 3513 3539 $failures++; … … 3517 3543 $body[] = ''; 3518 3544 } 3519 3545 3546 if ( empty( $update_results ) ) { 3547 return; 3548 } 3549 3520 3550 $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); 3521 3551 if ( $failures ) { 3522 3552 $body[] = trim( __( … … 3543 3573 $body[] = ''; 3544 3574 3545 3575 foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) { 3546 if ( ! isset( $ this->update_results[ $type ] ) )3576 if ( ! isset( $update_results[ $type ] ) ) 3547 3577 continue; 3548 foreach ( $this->update_results[ $type ] as $update ) { 3578 3579 foreach ( $update_results[ $type ] as $update ) { 3549 3580 $body[] = $update->name; 3550 3581 $body[] = str_repeat( '-', strlen( $update->name ) ); 3551 3582 foreach ( $update->messages as $message )