You are here

public function DaemonTCPIP::version in ClamAV 8

Same name and namespace in other branches
  1. 2.x src/Scanner/DaemonTCPIP.php \Drupal\clamav\Scanner\DaemonTCPIP::version()

The version of the ClamAV service.

Return value

string The version number provided by ClamAV.

Overrides ScannerInterface::version

File

src/Scanner/DaemonTCPIP.php, line 83

Class

DaemonTCPIP

Namespace

Drupal\clamav\Scanner

Code

public function version() {
  $handler = @fsockopen($this->_hostname, $this->_port);
  if (!$handler) {
    \Drupal::logger('Clam AV')
      ->warning('Unable to connect to ClamAV TCP/IP daemon on @hostname:@port', array(
      '@hostname' => $this->_hostname,
      '@port' => $this->_port,
    ));
    return NULL;
  }
  fwrite($handler, "VERSION\n");
  $content = fgets($handler);
  fclose($handler);
  return $content;
}