diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-07-07 11:38:20 -0700 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-07-07 11:38:20 -0700 |
commit | b1b0c57f5c8293e2dd38f3e5bc42093e625afb50 (patch) | |
tree | 3d4c0629c4811ebaa24ad4c773fef2c09babfdea /modules/update | |
parent | 3a59ca011335f53b443ed46dd1f7454cb596adf2 (diff) | |
download | brdo-b1b0c57f5c8293e2dd38f3e5bc42093e625afb50.tar.gz brdo-b1b0c57f5c8293e2dd38f3e5bc42093e625afb50.tar.bz2 |
Issue #1263040 by catch, akamaus, luk.stoops: Fixed No notifications sent when updates are available.
Diffstat (limited to 'modules/update')
-rw-r--r-- | modules/update/update.fetch.inc | 7 | ||||
-rw-r--r-- | modules/update/update.install | 1 | ||||
-rw-r--r-- | modules/update/update.module | 7 |
3 files changed, 13 insertions, 2 deletions
diff --git a/modules/update/update.fetch.inc b/modules/update/update.fetch.inc index e1790c3f2..860a1b975 100644 --- a/modules/update/update.fetch.inc +++ b/modules/update/update.fetch.inc @@ -352,7 +352,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/modules/update/update.install b/modules/update/update.install index 117611822..baf49538e 100644 --- a/modules/update/update.install +++ b/modules/update/update.install @@ -82,6 +82,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/modules/update/update.module b/modules/update/update.module index c42db0fa7..85c0968d5 100644 --- a/modules/update/update.module +++ b/modules/update/update.module @@ -300,13 +300,18 @@ function update_cron() { // configured notifications about the new status. update_refresh(); update_fetch_data(); - _update_cron_notify(); } else { // Otherwise, see if any individual projects are now stale or still // 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. + module_load_include('inc', 'update', 'update.fetch'); + _update_cron_notify(); + } // Clear garbage from disk. update_clear_update_disk_cache(); |