You are here

function smtp_requirements in SMTP Authentication Support 7

Same name and namespace in other branches
  1. 8 smtp.install \smtp_requirements()
  2. 6 smtp.module \smtp_requirements()
  3. 7.2 smtp.install \smtp_requirements()

Implements hook_requirements().

File

./smtp.install, line 11
The installation instructions for the SMTP Authentication Support.

Code

function smtp_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {
    if (variable_get('smtp_queue', FALSE) || variable_get('smtp_queue_fail', FALSE)) {
      $count = db_query("SELECT count('name') FROM {queue} WHERE name='smtp_send_queue'")
        ->fetchField();
      $requirements['smtp_queue'] = array(
        'title' => $t('SMTP Queue'),
        'value' => '',
        'severity' => REQUIREMENT_INFO,
      );
      if ($count > 0) {
        $requirements['smtp_queue']['value'] = format_plural($count, 'There is 1 message queued for delivery.', 'There are @count messages queued for delivery.', array(
          '@count' => $count,
        )) . ' ' . $t('Delivery of the message(s) will be attempted the next time cron runs.');
      }
      else {
        $requirements['smtp_queue']['value'] = $t('There are no messages queued for delivery.');
      }
    }
  }
  return $requirements;
}