You are here

function evercurrent_requirements in Evercurrent 7.2

Same name and namespace in other branches
  1. 8.2 evercurrent.install \evercurrent_requirements()
  2. 8 evercurrent.install \evercurrent_requirements()
  3. 7 evercurrent.module \evercurrent_requirements()

Implements hook_requirements().

Allow us to display current status in the site's status page.

File

./evercurrent.module, line 123
evercurrent.module

Code

function evercurrent_requirements($phase) {
  $requirements = array();

  // We only do stuff at runtime.
  if ($phase !== 'runtime') {
    return $requirements;
  }

  // @todo RMH-199 Just use line breaks for readability, no need for concatenation.
  // Listening enabled?
  $listen = variable_get('evercurrent_listen', FALSE);
  $listen_on_text = t('The Evercurrent module is listening for a key to use.
You should finish configuration on the server side,
or turn the listening feature off in the settings.');
  $requirements['evercurrent_listen'] = array(
    'title' => t('Evercurrent: Listening Mode'),
    'value' => $listen ? t('Listening enabled') : t('Disabled'),
    'severity' => $listen ? REQUIREMENT_WARNING : REQUIREMENT_OK,
    'description' => $listen ? $listen_on_text : '',
  );

  // Last run
  $requirements['evercurrent_lastrun'] = array(
    'title' => t('Evercurrent: Last successful run'),
    'value' => _evercurrent_last_run(),
    'severity' => REQUIREMENT_OK,
  );

  // Drop last status to the panel
  $message = variable_get(RMH_STATUS_MESSAGE, FALSE);
  $severity = variable_get(RMH_STATUS, RMH_STATUS_WARNING);
  $requirements['evercurrent_status'] = array(
    'title' => t('Evercurrent: Runtime status'),
    'value' => $message ? $message : t('No communication with server yet.'),
    'severity' => $severity,
  );
  return $requirements;
}