You are here

function new_relic_rpm_requirements in New Relic 7

Same name and namespace in other branches
  1. 8 new_relic_rpm.install \new_relic_rpm_requirements()
  2. 2.x new_relic_rpm.install \new_relic_rpm_requirements()
  3. 2.0.x new_relic_rpm.install \new_relic_rpm_requirements()

Implements hook_requirements().

File

./new_relic_rpm.install, line 11
Install and uninstall functions for the new_relic_rpm module.

Code

function new_relic_rpm_requirements($phase) {
  $requirements = array();
  $t = get_t();

  // We do not verify the extension at install time, to allow for testing when
  // it is not present.
  if ($phase == 'runtime') {
    $new_relic_loaded = extension_loaded('newrelic');
    $requirements['newrelic'] = array(
      'title' => $t('New Relic PHP Library'),
      'value' => $new_relic_loaded ? $t('Exists') : $t('Not loaded'),
      'severity' => $new_relic_loaded ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );
    $requirements['newrelic_apikey'] = array(
      'title' => $t('New Relic API key'),
      'value' => (variable_get('new_relic_rpm_api_key', 0) == '' ? $t('Not set') : $t('Available')) . ' (' . l(t('Configure'), 'admin/config/development/new-relic-rpm') . ')',
      'severity' => variable_get('new_relic_rpm_api_key', 0) == '' ? REQUIREMENT_INFO : REQUIREMENT_OK,
    );
  }
  return $requirements;
}