Ticket #33932: 33932.2.patch
File 33932.2.patch, 3.7 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/class-wp-upgrader.php
3472 3472 */ 3473 3473 protected function send_debug_email() { 3474 3474 $update_count = 0; 3475 foreach ( $this->update_results as $type => $updates ) 3475 $update_results = $this->update_results; 3476 foreach ( $update_results as $type => $updates ) 3476 3477 $update_count += count( $updates ); 3477 3478 3478 3479 $body = array(); … … 3481 3482 $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) ); 3482 3483 3483 3484 // Core 3484 if ( isset( $ this->update_results['core'] ) ) {3485 $result = $ this->update_results['core'][0];3485 if ( isset( $update_results['core'] ) ) { 3486 $result = $update_results['core'][0]; 3486 3487 if ( $result->result && ! is_wp_error( $result->result ) ) { 3487 3488 $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name ); 3488 3489 } else { … … 3494 3495 3495 3496 // Plugins, Themes, Translations 3496 3497 foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) { 3497 if ( ! isset( $this->update_results[ $type ] ) ) 3498 continue; 3499 $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) ); 3498 3499 /** 3500 * Filter whether to disable debug notification emails on plugins/themes/translation. 3501 * 3502 * By default, WordPress administrators are sent a debug e-mail for 3503 * automatic updates or when in development mode. This filter is 3504 * primarly used to disable automatic update notification e-mails 3505 * per type of update. 3506 * 3507 * @since 4.6.0 3508 * 3509 * @param bool $notify Whether the site administrator is notified. 3510 * @param string $type The type of update (plugin, theme, translation). 3511 * @param object $this WP_Automatic_Updater instance. 3512 */ 3513 if ( ! apply_filters( 'send_debug_notification_email', true, $type, $this ) ) { 3514 if ( isset( $update_results[ $type ] ) ) { 3515 unset( $update_results[ $type ] ); 3516 } 3517 } 3518 3519 if ( ! isset( $update_results[ $type ] ) ) 3520 continue; 3521 3522 $success_items = wp_list_filter( $update_results[ $type ], array( 'result' => true ) ); 3500 3523 if ( $success_items ) { 3501 3524 $messages = array( 3502 3525 'plugin' => __( 'The following plugins were successfully updated:' ), … … 3509 3532 $body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name ); 3510 3533 } 3511 3534 } 3512 if ( $success_items != $ this->update_results[ $type ] ) {3535 if ( $success_items != $update_results[ $type ] ) { 3513 3536 // Failed updates 3514 3537 $messages = array( 3515 3538 'plugin' => __( 'The following plugins failed to update:' ), … … 3518 3541 ); 3519 3542 3520 3543 $body[] = $messages[ $type ]; 3521 foreach ( $ this->update_results[ $type ] as $item ) {3544 foreach ( $update_results[ $type ] as $item ) { 3522 3545 if ( ! $item->result || is_wp_error( $item->result ) ) { 3523 3546 $body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name ); 3524 3547 $failures++; … … 3528 3551 $body[] = ''; 3529 3552 } 3530 3553 3554 if ( empty( $update_results ) ) { 3555 return; 3556 } 3557 3531 3558 $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); 3532 3559 if ( $failures ) { 3533 3560 $body[] = trim( __( … … 3554 3581 $body[] = ''; 3555 3582 3556 3583 foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) { 3557 if ( ! isset( $ this->update_results[ $type ] ) )3584 if ( ! isset( $update_results[ $type ] ) ) 3558 3585 continue; 3559 foreach ( $this->update_results[ $type ] as $update ) { 3586 3587 foreach ( $update_results[ $type ] as $update ) { 3560 3588 $body[] = $update->name; 3561 3589 $body[] = str_repeat( '-', strlen( $update->name ) ); 3562 3590 foreach ( $update->messages as $message )