function clamav_requirements in ClamAV 6
Same name and namespace in other branches
- 8 clamav.install \clamav_requirements()
- 7 clamav.install \clamav_requirements()
- 2.x clamav.install \clamav_requirements()
Implementation of hook_requirements().
File
- ./
clamav.install, line 10 - Hook_requirements for the ClamAV module.
Code
function clamav_requirements($phase) {
$t = get_t();
$requirements = array();
if ($phase == 'runtime') {
// try to connect on the current settings.
$mode = variable_get('clamav_mode', CLAMAV_DEFAULT_MODE);
if ($mode == CLAMAV_USE_DAEMON) {
$settings = array(
'host' => variable_get('clamav_daemon_host', CLAMAV_DEFAULT_HOST),
'port' => variable_get('clamav_daemon_port', CLAMAV_DEFAULT_PORT),
);
$mode = $t('Daemon');
}
elseif ($mode == CLAMAV_USE_EXECUTABLE) {
$settings = variable_get('clamav_executable_path', CLAMAV_DEFAULT_PATH);
$mode = $t('Executable');
}
require_once dirname(__FILE__) . '/clamav.inc';
$ver = clamav_get_version($settings);
// report success or failure.
$requirements[] = array(
'title' => $t('ClamAV'),
'value' => empty($ver) ? $t('@mode not found.', array(
'@mode' => $mode,
)) : $t('@mode: @version', array(
'@mode' => $mode,
'@version' => $ver,
)),
'severity' => empty($ver) ? REQUIREMENT_ERROR : REQUIREMENT_OK,
);
}
return $requirements;
}