Ticket #33932: 33932.3.patch
File 33932.3.patch, 3.9 KB (added by , 8 years ago) |
---|
-
Users/jasonandrews/desktop/develop.svn.wordpress.org
786 786 */ 787 787 protected function send_debug_email() { 788 788 $update_count = 0; 789 foreach ( $this->update_results as $type => $updates ) 789 $update_results = $this->update_results; 790 foreach ( $update_results as $type => $updates ) 790 791 $update_count += count( $updates ); 791 792 792 793 $body = array(); … … 795 796 $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) ); 796 797 797 798 // Core 798 if ( isset( $ this->update_results['core'] ) ) {799 $result = $ this->update_results['core'][0];799 if ( isset( $update_results['core'] ) ) { 800 $result = $update_results['core'][0]; 800 801 if ( $result->result && ! is_wp_error( $result->result ) ) { 801 802 $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name ); 802 803 } else { … … 808 809 809 810 // Plugins, Themes, Translations 810 811 foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) { 811 if ( ! isset( $this->update_results[ $type ] ) ) 812 continue; 813 $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) ); 812 813 /** 814 * Filter whether to disable debug notification emails on plugins/themes/translation. 815 * 816 * By default, WordPress administrators are sent a debug e-mail for 817 * automatic updates or when in development mode. This filter is 818 * primarly used to disable automatic update notification e-mails 819 * per type of update. 820 * 821 * @since 4.6.0 822 * 823 * @param bool $notify Whether the site administrator is notified. 824 * @param string $type The type of update (plugin, theme, translation). 825 * @param object $this WP_Automatic_Updater instance. 826 */ 827 if ( ! apply_filters( 'send_debug_notification_email', true, $type, $this ) ) { 828 if ( isset( $update_results[ $type ] ) ) { 829 unset( $update_results[ $type ] ); 830 } 831 } 832 833 if ( ! isset( $update_results[ $type ] ) ) 834 continue; 835 836 $success_items = wp_list_filter( $update_results[ $type ], array( 'result' => true ) ); 814 837 if ( $success_items ) { 815 838 $messages = array( 816 839 'plugin' => __( 'The following plugins were successfully updated:' ), … … 823 846 $body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name ); 824 847 } 825 848 } 826 if ( $success_items != $ this->update_results[ $type ] ) {849 if ( $success_items != $update_results[ $type ] ) { 827 850 // Failed updates 828 851 $messages = array( 829 852 'plugin' => __( 'The following plugins failed to update:' ), … … 832 855 ); 833 856 834 857 $body[] = $messages[ $type ]; 835 foreach ( $ this->update_results[ $type ] as $item ) {858 foreach ( $update_results[ $type ] as $item ) { 836 859 if ( ! $item->result || is_wp_error( $item->result ) ) { 837 860 $body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name ); 838 861 $failures++; … … 842 865 $body[] = ''; 843 866 } 844 867 868 if ( empty( $update_results ) ) { 869 return; 870 } 871 845 872 $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); 846 873 if ( $failures ) { 847 874 $body[] = trim( __( … … 868 895 $body[] = ''; 869 896 870 897 foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) { 871 if ( ! isset( $ this->update_results[ $type ] ) )898 if ( ! isset( $update_results[ $type ] ) ) 872 899 continue; 873 foreach ( $ this->update_results[ $type ] as $update ) {900 foreach ( $update_results[ $type ] as $update ) { 874 901 $body[] = $update->name; 875 902 $body[] = str_repeat( '-', strlen( $update->name ) ); 876 903 foreach ( $update->messages as $message )