You are here

public function DaemonUnixSocket::version in ClamAV 8

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

The version of the ClamAV service.

Return value

string The version number provided by ClamAV.

Overrides ScannerInterface::version

File

src/Scanner/DaemonUnixSocket.php, line 75

Class

DaemonUnixSocket

Namespace

Drupal\clamav\Scanner

Code

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