You are here

function health_email_send in Health Status 7

Determines if the Health status e-mail should be sent.

The e-mail should only be sent if health status monitors report a threshold that the user has requested to receive e-mails for.

1 call to health_email_send()
health_cron in ./health.module
Implements hook_cron().

File

./health.module, line 107
Contains the basic hooks and function used by the Health system.

Code

function health_email_send() {
  $thresholds = array_keys(array_filter(variable_get('health_email_threshold', array())));
  $data = health_get_data();
  foreach ($data as $group => $results) {
    foreach ($results as $monitor => $r) {
      if (in_array($r['status'], $thresholds)) {

        // User needs to receive e-mail for this threshold.
        return TRUE;
      }
    }
  }

  // User does not need to receive e-mail.
  return FALSE;
}