• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WP_Automatic_Updater::send_debug_email() – Prepares and sends an email of a full log of background update results, useful for debugging and geekery.

You appear to be a bot. Output may be restricted

Description

Prepares and sends an email of a full log of background update results, useful for debugging and geekery.

Usage

WP_Automatic_Updater::send_debug_email();

Parameters

Returns

void

Source

File name: wordpress/wp-admin/includes/class-wp-automatic-updater.php
Lines:

1 to 100 of 165
  protected function send_debug_email() {
    $update_count = 0;
    foreach ( $this->update_results as $type => $updates ) {
      $update_count += count( $updates );
    }

    $body     = array();
    $failures = 0;

    /* translators: %s: Network home URL. */
    $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) );

    // Core.
    if ( isset( $this->update_results['core'] ) ) {
      $result = $this->update_results['core'][0];
      if ( $result->result && ! is_wp_error( $result->result ) ) {
        /* translators: %s: WordPress version. */
        $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name );
      } else {
        /* translators: %s: WordPress version. */
        $body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name );
        $failures++;
      }
      $body[] = '';
    }

    // Plugins, Themes, Translations.
    foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
      if ( ! isset( $this->update_results[ $type ] ) ) {
        continue;
      }
      $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
      if ( $success_items ) {
        $messages = array(
          'plugin'      => __( 'The following plugins were successfully updated:' ),
          'theme'       => __( 'The following themes were successfully updated:' ),
          'translation' => __( 'The following translations were successfully updated:' ),
        );

        $body[] = $messages[ $type ];
        foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) {
          /* translators: %s: Name of plugin / theme / translation. */
          $body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name );
        }
      }
      if ( $success_items != $this->update_results[ $type ] ) {
        // Failed updates.
        $messages = array(
          'plugin'      => __( 'The following plugins failed to update:' ),
          'theme'       => __( 'The following themes failed to update:' ),
          'translation' => __( 'The following translations failed to update:' ),
        );

        $body[] = $messages[ $type ];
        foreach ( $this->update_results[ $type ] as $item ) {
          if ( ! $item->result || is_wp_error( $item->result ) ) {
            /* translators: %s: Name of plugin / theme / translation. */
            $body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name );
            $failures++;
          }
        }
      }
      $body[] = '';
    }

    $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
    if ( $failures ) {
      $body[] = trim(
        __(
          "BETA TESTING?
=============

This debugging email is sent when you are using a development version of WordPress.

If you think these failures might be due to a bug in WordPress, could you report it?
 * Open a thread in the support forums: https://wordpress.org/support/forum/alphabeta
 * Or, if you're comfortable writing a bug report: https://core.trac.wordpress.org/

Thanks! -- The WordPress Team"
        )
      );
      $body[] = '';

      /* translators: Background update failed notification email subject. %s: Site title. */
      $subject = sprintf( __( '[%s] Background Update Failed' ), $site_title );
    } else {
      /* translators: Background update finished notification email subject. %s: Site title. */
      $subject = sprintf( __( '[%s] Background Update Finished' ), $site_title );
    }

    $body[] = trim(
      __(
        'UPDATE LOG
=========='
      )
    );
    $body[] = '';

    foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) {
      if ( ! isset( $this->update_results[ $type ] ) ) {
 
[1] [2] Next »

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 2nd April 2020

Primary Sidebar

Information

Function name: WP_Automatic_Updater::send_debug_email
Class ref: WP_Automatic_Updater
Plugin ref: WordPress
Version: 5.7.1
Sourcefile: wp-admin/includes/class-wp-automatic-updater.php
File ref: wp-admin/includes/class-wp-automatic-updater.php
Deprecated?: No
API Letters: A,D,S,U,W

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.7.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites