diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc index 8588832..287177c 100644 --- a/core/modules/update/update.fetch.inc +++ b/core/modules/update/update.fetch.inc @@ -330,7 +330,12 @@ function _update_cron_notify() { else { $target_language = $default_language; } - drupal_mail('update', 'status_notify', $target, $target_language, $params); + $message = drupal_mail('update', 'status_notify', $target, $target_language, $params); + // Track when the last mail was successfully sent to avoid sending + // too many e-mails. + if ($message['result']) { + variable_set('update_last_email_notification', REQUEST_TIME); + } } } } diff --git a/core/modules/update/update.install b/core/modules/update/update.install index 9ff39d1..ddd16f9 100644 --- a/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -83,6 +83,7 @@ function update_uninstall() { 'update_check_frequency', 'update_fetch_url', 'update_last_check', + 'update_last_email_notification', 'update_notification_threshold', 'update_notify_emails', 'update_max_fetch_attempts', diff --git a/core/modules/update/update.module b/core/modules/update/update.module index ea9aec2..5938f56 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -301,6 +301,11 @@ function update_cron() { // missing data, and if so, try to fetch the data. update_get_available(TRUE); } + if ((REQUEST_TIME - variable_get('update_last_email_notification', 0)) > $interval) { + // If configured time between notifications elapsed, send email about + // updates possibly available. + _update_cron_notify(); + } // Clear garbage from disk. update_clear_update_disk_cache();