Make WordPress Core

Ticket #50268: 50268.2.diff

File 50268.2.diff, 7.4 KB (added by desrosj, 5 years ago)
  • src/wp-admin/includes/class-wp-automatic-updater.php

     
    941941                if ( empty( $successful_updates ) && empty( $failed_updates ) ) {
    942942                        return;
    943943                }
    944                 $body = array();
     944                $body               = array();
     945                $successful_plugins = ( ! empty( $successful_updates['plugin'] ) );
     946                $successful_themes  = ( ! empty( $successful_updates['theme'] ) );
     947                $failed_plugins     = ( ! empty( $failed_updates['plugin'] ) );
     948                $failed_themes      = ( ! empty( $failed_updates['theme'] ) );
    945949
    946950                switch ( $type ) {
    947951                        case 'success':
    948                                 /* translators: %s: Site title. */
    949                                 $subject = __( '[%s] Some plugins or themes were automatically updated' );
     952                                if ( $successful_plugins && $successful_themes ) {
     953                                        /* translators: %s: Site title. */
     954                                        $subject = __( '[%s] Some plugins and themes were automatically updated' );
     955                                        $body[]  = sprintf(
     956                                                /* translators: %s: Home URL. */
     957                                                __( 'Howdy! Some plugins and themes have been automatically updated to new versions on your site at %s. No further action is needed on your part.' ),
     958                                                home_url()
     959                                        );
     960                                } elseif ( $successful_plugins ) {
     961                                        /* translators: %s: Site title. */
     962                                        $subject = __( '[%s] Some plugins were automatically updated' );
     963                                        $body[]  = sprintf(
     964                                                /* translators: %s: Home URL. */
     965                                                __( 'Howdy! Some plugins have been automatically updated to new versions on your site at %s. No further action is needed on your part.' ),
     966                                                home_url()
     967                                        );
     968                                } else {
     969                                        /* translators: %s: Site title. */
     970                                        $subject = __( '[%s] Some themes were automatically updated' );
     971                                        $body[]  = sprintf(
     972                                                /* translators: %s: Home URL. */
     973                                                __( 'Howdy! Some themes have been automatically updated to new versions on your site at %s. No further action is needed on your part.' ),
     974                                                home_url()
     975                                        );
     976                                }
     977
    950978                                break;
    951979                        case 'fail':
    952                                 /* translators: %s: Site title. */
    953                                 $subject = __( '[%s] Some plugins or themes have failed to update' );
    954                                 $body[]  = sprintf(
    955                                         /* translators: %s: Home URL. */
    956                                         __( 'Howdy! Failures occurred when attempting to update plugins/themes on your site at %s.' ),
    957                                         home_url()
    958                                 );
    959                                 $body[] = "\n";
    960                                 $body[] = __( 'Please check out your site now. It’s possible that everything is working. If it says you need to update, you should do so.' );
    961                                 break;
    962980                        case 'mixed':
    963                                 /* translators: %s: Site title. */
    964                                 $subject = __( '[%s] Some plugins or themes were automatically updated' );
    965                                 $body[]  = sprintf(
    966                                         /* translators: %s: Home URL. */
    967                                         __( 'Howdy! Failures occurred when attempting to update plugins/themes on your site at %s.' ),
    968                                         home_url()
    969                                 );
    970                                 $body[] = "\n";
    971                                 $body[] = __( 'Please check out your site now. It’s possible that everything is working. If it says you need to update, you should do so.' );
    972                                 $body[] = "\n";
     981                                if ( $failed_plugins && $failed_themes ) {
     982                                        /* translators: %s: Site title. */
     983                                        $subject = __( '[%s] Some plugins and themes have failed to update' );
     984                                        $body[]  = sprintf(
     985                                                /* translators: %s: Home URL. */
     986                                                __( 'Howdy! Failures occurred when attempting to update plugins and themes on your site at %s.' ),
     987                                                home_url()
     988                                        );
     989                                } elseif ( $failed_plugins ) {
     990                                        /* translators: %s: Site title. */
     991                                        $subject = __( '[%s] Some plugins have failed to update' );
     992                                        $body[]  = sprintf(
     993                                                /* translators: %s: Home URL. */
     994                                                __( 'Howdy! Failures occurred when attempting to update plugins on your site at %s.' ),
     995                                                home_url()
     996                                        );
     997                                } else {
     998                                        /* translators: %s: Site title. */
     999                                        $subject = __( '[%s] Some themes have failed to update' );
     1000                                        $body[]  = sprintf(
     1001                                                /* translators: %s: Home URL. */
     1002                                                __( 'Howdy! Failures occurred when attempting to update themes on your site at %s.' ),
     1003                                                home_url()
     1004                                        );
     1005                                }
     1006
    9731007                                break;
    9741008                }
    9751009
    976                 // Get failed plugin updates.
    977                 if ( in_array( $type, array( 'fail', 'mixed' ), true ) && ! empty( $failed_updates['plugin'] ) ) {
    978                         $body[] = __( 'The following plugins failed to update:' );
    979                         // List failed updates.
    980                         foreach ( $failed_updates['plugin'] as $item ) {
    981                                 $body[] = "- {$item->name}";
    982                         }
     1010                if ( in_array( $type, array( 'fail', 'mixed' ), true ) ) {
    9831011                        $body[] = "\n";
    984                 }
    985                 // Get failed theme updates.
    986                 if ( in_array( $type, array( 'fail', 'mixed' ), true ) && ! empty( $failed_updates['theme'] ) ) {
    987                         $body[] = __( 'The following themes failed to update:' );
    988                         // List failed updates.
    989                         foreach ( $failed_updates['theme'] as $item ) {
    990                                 $body[] = "- {$item->name}";
     1012                        $body[] = __( 'Please check out your site now. It’s possible that everything is working. If it says you need to update, you should do so.' );
     1013
     1014                        // List failed plugin updates.
     1015                        if ( ! empty( $failed_updates['plugin'] ) ) {
     1016                                $body[] = "\n";
     1017                                $body[] = __( 'The following plugins failed to update:' );
     1018
     1019                                foreach ( $failed_updates['plugin'] as $item ) {
     1020                                        $body[] = "- {$item->name}";
     1021                                }
     1022                                $body[] = "\n";
    9911023                        }
    992                         $body[] = "\n";
    993                 }
    994                 // Get successful plugin updates.
    995                 if ( in_array( $type, array( 'success', 'mixed' ), true ) && ! empty( $successful_updates['plugin'] ) ) {
    996                         $body[] = __( 'The following plugins were successfully updated:' );
    997                         // List successful updates.
    998                         foreach ( $successful_updates['plugin'] as $item ) {
    999                                 $body[] = "- {$item->name}";
     1024
     1025                        // List failed theme updates.
     1026                        if ( ! empty( $failed_updates['theme'] ) ) {
     1027                                $body[] = __( 'The following themes failed to update:' );
     1028
     1029                                foreach ( $failed_updates['theme'] as $item ) {
     1030                                        $body[] = "- {$item->name}";
     1031                                }
     1032                                $body[] = "\n";
    10001033                        }
    1001                         $body[] = "\n";
    10021034                }
    1003                 // Get successful theme updates.
    1004                 if ( in_array( $type, array( 'success', 'mixed' ), true ) && ! empty( $successful_updates['theme'] ) ) {
    1005                         $body[] = __( 'The following themes were successfully updated:' );
    1006                         // List successful updates.
    1007                         foreach ( $successful_updates['theme'] as $item ) {
    1008                                 $body[] = "- {$item->name}";
     1035
     1036                // List successful updates.
     1037                if ( in_array( $type, array( 'success', 'mixed' ), true ) ) {
     1038                        // List successful plugin updates.
     1039                        if ( ! empty( $successful_updates['plugin'] ) ) {
     1040                                $body[] = "\n";
     1041                                $body[] = __( 'The following plugins were successfully updated:' );
     1042
     1043                                foreach ( $successful_updates['plugin'] as $item ) {
     1044                                        $body[] = "- {$item->name}";
     1045                                }
    10091046                        }
    1010                         $body[] = "\n";
     1047
     1048                        // List successful theme updates.
     1049                        if ( ! empty( $successful_updates['theme'] ) ) {
     1050                                $body[] = "\n";
     1051                                $body[] = __( 'The following themes were successfully updated:' );
     1052                                // List successful updates.
     1053                                foreach ( $successful_updates['theme'] as $item ) {
     1054                                        $body[] = "- {$item->name}";
     1055                                }
     1056                        }
     1057                }
     1058
     1059                $body[] = "\n";
     1060
     1061                if ( $successful_plugins || $failed_plugins ) {
     1062                        $body[] = sprintf(
     1063                                /* translators: %s: Plugins screen URL. */
     1064                                __( 'To manage plugins on your site, visit the Plugins page: %s' ),
     1065                                admin_url( 'plugins.php' )
     1066                        );
    10111067                }
     1068
     1069                if ( $successful_themes || $failed_themes ) {
     1070                        $body[] = sprintf(
     1071                                /* translators: %s: Themes screen URL. */
     1072                                __( 'To manage themes on your site, visit the Themes page: %s' ),
     1073                                admin_url( 'themes.php' )
     1074                        );
     1075                }
     1076
    10121077                $body[] = "\n";
    10131078
    10141079                // Add a note about the support forums.