You are here

function tfa_requirements in Two-factor Authentication (TFA) 8

Same name and namespace in other branches
  1. 7.2 tfa.install \tfa_requirements()

Implements hook_requirements().

File

./tfa.install, line 13
Installation related functions for TFA module.

Code

function tfa_requirements($phase) {
  $requirements = [];
  if ($phase == 'runtime') {
    if (!extension_loaded('openssl')) {
      if (extension_loaded('mcrypt')) {
        $severity = REQUIREMENT_WARNING;
        $description = t('The TFA module recommends the PHP OpenSSL extension to be installed on the web server.');
      }
      else {
        $severity = REQUIREMENT_ERROR;
        $description = t('The TFA module requires either the PHP OpenSSL or Mcrypt extensions to be installed on the web server.');
      }
      $requirements['tfa_extensions'] = [
        'title' => t('Two-factor authentication'),
        'value' => t('Required PHP extensions'),
        'description' => $description,
        'severity' => $severity,
      ];
    }
  }
  return $requirements;
}