You are here

function radioactivity_requirements in Radioactivity 7.2

Same name and namespace in other branches
  1. 6 radioactivity.module \radioactivity_requirements()

Implements hook_requirements().

File

./radioactivity.module, line 192
Radioactivity core functionality

Code

function radioactivity_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $desc = '';
  if ($phase == 'runtime') {
    module_load_include("inc", "radioactivity", "radioactivity-bootstrap");
    $config_warning = variable_get('radioactivity_config_warning', FALSE);
    $bootstrap_warning = variable_get('radioactivity_bootstrap_warning', FALSE);
    if ($config_warning || $bootstrap_warning) {
      $level = REQUIREMENT_WARNING;
      $value = $t('Performance issues');
      $vars = array(
        "@file" => _radioactivity_get_config_file_path(),
        "@reset" => url("admin/structure/radioactivity/settings/reset/messages", array(
          "query" => array(
            drupal_get_destination(),
          ),
        )),
        "@assist" => url("admin/structure/radioactivity/settings", array(
          "fragment" => "edit-assist",
        )),
      );
      if ($config_warning) {
        $desc .= $t('Configuration file @file appears be missing. Have a look at the <a href="@assist">Radioactivity configuration assist</a> for further information.', $vars) . ' ';
      }
      if ($bootstrap_warning) {
        $desc .= $t('One of the decay profiles is using a storage system that requires Drupal to boostrap. This may lead to serious slowdowns on high traffic sites. You should consider switching to one of the bootstrapless incident storages.', $vars) . ' ';
      }
      $desc .= $t('Once fixed click <a href="@reset">here</a> to clear Radioactivity warnings and caches, then reload an emitting page and check if problems have been resolved.', $vars);
    }
    else {
      $level = REQUIREMENT_OK;
      $desc = '';
      $value = $t('OK');
    }
    $requirements['radioactivity'] = array(
      'title' => $t('Radioactivity'),
      'description' => $desc,
      'value' => $value,
      'severity' => $level,
    );
  }
  return $requirements;
}