You are here

function badbehavior_requirements in Bad Behavior 6.2

Same name and namespace in other branches
  1. 6 badbehavior.install \badbehavior_requirements()
  2. 7.2 badbehavior.install \badbehavior_requirements()

Implements hook_requirements().

File

./badbehavior.install, line 70
Install, update and uninstall functions for the Bad Behavior module.

Code

function badbehavior_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    if (badbehavior_load_includes()) {
      if (empty($base_url)) {
        $base_url = $GLOBALS['base_url'];
      }
      if (BB2_VERSION == '2.2.15') {
        $requirements['badbehavior'] = array(
          'value' => BB2_VERSION,
          'severity' => REQUIREMENT_OK,
        );
      }
      else {
        $requirements['badbehavior'] = array(
          'value' => BB2_VERSION,
          'severity' => REQUIREMENT_WARNING,
          'description' => t('Bad Behavior files are installed, but are not the recommended version (2.2.15). See the <code>!readme</code> for exact installation details.', array(
            '!readme' => l(t('README.txt'), $base_url . drupal_get_path('module', 'badbehavior') . '/README.txt'),
          )),
        );
      }
    }
    else {
      $requirements['badbehavior'] = array(
        'value' => t('Missing BadBehavior library'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t('Required Bad Behavior files are not found. See the <code>!readme</code> for installation details.', array(
          '!readme' => l(t('README.txt'), $base_url . drupal_get_path('module', 'badbehavior') . '/README.txt'),
        )),
      );
    }
    $requirements['badbehavior']['title'] = t('Bad Behavior');
  }
  return $requirements;
}