You are here

function answers_requirements in Answers 7.4

Same name and namespace in other branches
  1. 6.2 answers.install \answers_requirements()
  2. 6 answers.install \answers_requirements()
  3. 7.3 answers.install \answers_requirements()

Implements hook_requirements().

File

./answers.install, line 226
Install, update, and uninstall functions for the answers module.

Code

function answers_requirements($phase) {
  if ($phase == 'runtime') {
    module_load_include('inc', 'answers', 'includes/answers.helpers');
    $t = get_t();
    $info = system_get_info('module', 'answers');
    $requirements['answers'] = array(
      'title' => $t('Answers'),
      'value' => $info['version'],
      'severity' => REQUIREMENT_OK,
    );
    $orphan_nids = _answers_orphan_nids();
    $questions = node_load_multiple($orphan_nids);
    $orphans = count($questions);
    if ($orphans > 0) {
      $d_options = array_merge(array(
        '!count' => $orphans,
        '@url' => url('admin/config/content/answers/orphan'),
      ), answers_translation());
      $requirements['answers']['description'] = $t('!count <a href="@url">Orphaned</a> !answers', $d_options);
      $requirements['answers']['severity'] = REQUIREMENT_WARNING;
    }
    return $requirements;
  }
}