From 6048f75b93ac535dcd6a5821543db1b7756f53cb Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 21 Sep 2013 06:59:25 +0000 Subject: [PATCH] WordPress Core Automatic Updates: Add a filter as to whether or not to send the site administrator a summary of executed updates. Props JustinSainton. See #22704 git-svn-id: https://develop.svn.wordpress.org/trunk@25542 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-upgrader.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index 5fb67a2061..1bc308356e 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -1508,7 +1508,19 @@ class WP_Automatic_Upgrader { wp_update_themes(); // Check for Theme updates wp_update_plugins(); // Check for Plugin updates - self::send_email(); + /** + * Filter whether to email an update summary to the site administrator. + * + * @since 3.7.0 + * + * @param bool Whether or not email should be sent to administrator. Default true. + * @param bool|array $core_update An array of core update data, false otherwise. + * @param object $theme_updates Object containing theme update properties. + * @param object $plugin_updates Object containing plugin update properties. + * @param array $upgrade_results An array of the upgrade results keyed by upgrade type, and plugin/theme slug + */ + if ( apply_filters( 'enable_auto_upgrade_email', true, $core_update, $theme_updates, $plugin_updates, self::$upgrade_results ) ) + self::send_email(); // Clear the lock delete_site_option( $lock_name ); @@ -1590,7 +1602,7 @@ class WP_Automatic_Upgrader { wp_mail( get_site_option( 'admin_email' ), $subject, - implode( "\n", $body ) + implode( "\n", $body ) ); }