You are here

clamav.install in ClamAV 6

Same filename and directory in other branches
  1. 8 clamav.install
  2. 7 clamav.install
  3. 2.x clamav.install

Hook_requirements for the ClamAV module.

File

clamav.install
View source
<?php

/**
 * @file
 * Hook_requirements for the ClamAV module.
 */

/**
 * Implementation of hook_requirements().
 */
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;
}

Functions

Namesort descending Description
clamav_requirements Implementation of hook_requirements().