WP_Automatic_Updater::send_debug_email()
- Since
- 3.7.0
- Source
wp-admin/includes/class-wp-automatic-updater.php:1559
Compatibility
- WordPress
- since 3.7.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Performance profile
How much work a call to WP_Automatic_Updater::send_debug_email() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Expensive
- Scaling
- Scales with input
- Instructions
- 102–142
- Plugin surface
- 1 hook
- Called by
- 1
Sends mail via wp_mail().
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 376.
Third-party callbacks on 'automatic_updates_debug_email' run inside this call, and their cost is not bounded by anything here.
1 place in core call this, so the cost is paid more often than your own code shows.
What it touches
- querycontent query
get_user_by()called directly - optionnetwork option
get_site_option()called directly - hookthird-party callbacks
apply_filters()called directly - mailsends mail
wp_mail()called directly
Further down the call graph this can also reach cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 48 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Automatic_Updater::send_debug_email() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($value) | 102–104 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
!isset($value) | 103–105 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
!isset($value) | 104–106 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
!isset($value) | 104–106 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
!isset($value) | 105–107 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
!isset($value) | 105–107 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
!isset($value) | 106–108 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
!isset($value) | 107–109 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
!isset($value) | 111–113 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
!isset($value) | 112–114 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
!isset($value) | 113–115 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
!isset($value) | 113–115 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
36 further outcomes, up to 142 instructions
!isset($value) | 114–116 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
!isset($value) | 114–116 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
!isset($value) | 115–117 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
!isset($value) | 116–118 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 120–122 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && !$result | 121–123 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && !$result | 122–124 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && !$result | 122–124 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 123–125 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && !$result | 123–125 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 124–126 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 125–127 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && $result | 126–128 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 127–129 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 128–130 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 128–130 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && $result | 129–131 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && !$result | 129–131 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 129–131 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 130–132 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 130–132 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 131–133 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 131–133 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 131–133 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 132–134 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && !$result | 132–134 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 133–135 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && !$result | 134–136 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && $result | 135–137 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 136–138 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 137–139 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 137–139 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && $result | 138–140 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail() |
isset($value) && $result | 138–140 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), home_url(), parse_url(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && $result | 139–141 | get_site_option(), get_user_by(), get_locale(), switch_to_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
isset($value) && $result | 140–142 | get_site_option(), get_user_by(), switch_to_user_locale(), __(), network_home_url(), sprintf(), is_wp_error(), __(), sprintf(), get_bloginfo(), get_bloginfo(), wp_specialchars_decode(), __(), __(), sprintf(), __(), get_site_option(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 376 | 102–142 | 32 | |
| 8.5 | 376 | 102–142 | 32 | |
| 8.4 | 376 | 102–142 | 32 | 13 fewer instructions than PHP 8.3 |
| 8.3 | 389 | 107–149 | 32 | |
| 8.2 | 389 | 107–149 | 32 | |
| 8.1 | 389 | 107–149 | 32 | |
| 7.4 | 389 | 107–149 | 32 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 1
One hook fires while WP_Automatic_Updater::send_debug_email() runs, in this order:
- apply_filters( automatic_updates_debug_email )filterline 1741 (+182 into the body)
Filters the debug email that can be sent following an automatic background core update.
Uses · 16
- get_user_by()Retrieves user info by a given field.
- get_site_option()Retrieve an option value for the current network based on name of option.
- switch_to_user_locale()Switches the translations according to the given user's locale.
- switch_to_locale()Switches the translations according to the given locale.
- get_locale()Retrieves the current locale.
- __()Retrieves the translation of $text.
- network_home_url()Retrieves the home URL for the current network.
- is_wp_error()Checks whether the given variable is a WordPress Error.
- wp_list_filter()Filters a list of objects, based on a set of key => value arguments.
- wp_list_pluck()Plucks a certain field out of each object or array in an array.
- get_bloginfo()Retrieves information about the current site.
- wp_specialchars_decode()Converts a number of HTML entities into their special characters.
Show all 16
- home_url()Retrieves the URL for the current site where the front end is accessible.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- wp_mail()Sends an email, similar to PHP's mail function.
- restore_previous_locale()Restores the translations according to the previous locale.
Used by · 1
- WP_Automatic_Updater::run()Kicks off the background update process, looping through all pending updates.
Source code
protected function send_debug_email() { $admin_user = get_user_by( 'email', get_site_option( 'admin_email' ) ); if ( $admin_user ) { $switched_locale = switch_to_user_locale( $admin_user->ID ); } else { $switched_locale = switch_to_locale( get_locale() ); } $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[] = ''; } if ( '' !== get_bloginfo( 'name' ) ) { $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); } else { $site_title = parse_url( home_url(), PHP_URL_HOST ); }Changelog
Introduced in 3.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-admin/includes/class-wp-automatic-updater.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.