You are here

function queue_mail_requirements in Queue Mail 7

Same name and namespace in other branches
  1. 8 queue_mail.install \queue_mail_requirements()
  2. 5 queue_mail.install \queue_mail_requirements()
  3. 6 queue_mail.install \queue_mail_requirements()

Implements hook_requirements().

File

./queue_mail.install, line 30
Install, update and uninstall functions for the Queue Mail module.

Code

function queue_mail_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'runtime':
      $queue_length = _queue_mail_get_queue()
        ->numberOfItems();
      $requirements['queue_mail'] = array(
        'title' => t('Queue mail'),
        'value' => $queue_length > 0 ? format_plural($queue_length, '1 mail currently queued for sending.', '@count mails currently queued for sending.') : t('Mail queue is empty'),
        'severity' => $queue_length > 0 ? REQUIREMENT_INFO : REQUIREMENT_OK,
        'description' => variable_get('queue_mail_send_on_cron', TRUE) ? t('Sending of queued mails happens on cron. You can <a href="@cron_link">run cron manually</a>.', array(
          '@cron_link' => url('admin/reports/status/run-cron', array(
            'query' => drupal_get_destination(),
          )),
        )) : t('Sending of queued mails on cron is disabled.'),
      );
      break;
  }
  return $requirements;
}