function tfa_requirements in Two-factor Authentication (TFA) 7.2
Same name and namespace in other branches
- 8 tfa.install \tfa_requirements()
Implements hook_requirements().
File
- ./
tfa.install, line 28 - Install and update hooks.
Code
function tfa_requirements($phase) {
$t = get_t();
if ($phase == 'runtime') {
if (!extension_loaded('openssl')) {
if (extension_loaded('mcrypt')) {
$requirement_severity = REQUIREMENT_WARNING;
$description = $t('The TFA module recommends the PHP OpenSSL extension to be installed on the web server.');
}
else {
$requirement_severity = REQUIREMENT_ERROR;
$description = $t('The TFA module requires either the PHP OpenSSL or Mcrypt extensions to be installed on the web server.');
}
}
else {
$requirement_severity = REQUIREMENT_OK;
$description = '';
}
$enabled = variable_get('tfa_enabled', 0);
$msg = $enabled ? 'Enabled' : 'Not enabled';
$requirements = array(
array(
'title' => $t('Two-factor authentication'),
'value' => $t($msg),
'description' => $description,
'severity' => $requirement_severity,
),
);
return $requirements;
}
return array();
}