You are here

function aes_requirements in AES encryption 7

Same name and namespace in other branches
  1. 8.2 aes.install \aes_requirements()
  2. 6 aes.install \aes_requirements()

Implements hook_requirements().

File

./aes.install, line 11
Install/uninstall related functions.

Code

function aes_requirements($phase) {

  // Make sure translations won't break on install.
  $t = get_t();
  $aes_implementations = aes_get_available_aes_implementations();
  if ($aes_implementations['mcrypt'] === FALSE && $aes_implementations['phpseclib'] === FALSE) {
    $requirement_severity = REQUIREMENT_ERROR;
    $value = $t('The AES encryption module requires at least one of two things to function: Either the PHP Mcrypt extension has to be installed on the web server, or the PHP Secure Communications Library (phpseclib) needs to be installed in the AES directory. Check the README.txt for more information.');
  }
  else {
    $requirement_severity = REQUIREMENT_OK;
    if ($aes_implementations['mcrypt'] && $aes_implementations['phpseclib']) {
      $value = t('Both MCrypt and PHP Secure Communications Library are available.');
    }
    else {
      if ($aes_implementations['mcrypt']) {
        $value = t('MCrypt is available.');
      }
      else {
        $value = t('PHP Secure Communications Library is available.');
      }
    }
  }
  $requirements['aes'] = array(
    'title' => $t('AES encryption implementation'),
    'value' => $value,
    'severity' => $requirement_severity,
  );
  return $requirements;
}