11require_once 
"./Services/VirusScanner/classes/class.ilVirusScanner.php";
 
   24        parent::__construct($a_scancommand, $a_cleancommand);
 
   25        $this->type = 
"clamav";
 
   26        $this->scanZipFiles = 
true;
 
   34        return $this->scanCommand . 
' ' . self::ADD_SCAN_PARAMS . 
' ' . $file;
 
   42        $functions = array(
'proc_open', 
'proc_close');
 
   44        foreach ($functions as $func) {
 
   45            if (function_exists($func)) {
 
   74        $descriptorspec = array(
 
   75            0 => array(
"pipe", 
"r"),  
 
   76            1 => array(
"pipe", 
"w"),  
 
   77            2 => array(
"pipe", 
"w")             
 
   86        if (!is_resource($process)) {
 
   90        fwrite($pipes[0], $buffer);
 
   93        $detectionReport = stream_get_contents($pipes[1]);
 
   96        $errorReport = stream_get_contents($pipes[2]);
 
   99        $return = proc_close($process);
 
  110        return preg_match(
"/FOUND/", $detectionReport);
 
  120    public function scanFile($a_filepath, $a_origname = 
"")
 
  132        $this->scanFilePath = $a_filepath;
 
  133        $this->scanFileOrigName = $a_origname;
 
  136        $currentPermission = fileperms($a_filepath);
 
  137        $perm = $currentPermission | 0640;
 
  138        chmod($a_filepath, $perm);
 
  143        $this->scanResult = implode(
"\n", 
$out);
 
  145        if ($perm != $currentPermission) {
 
  146            chmod($a_filepath, $currentPermission);
 
  151            $this->scanFileIsInfected = 
true;
 
  155            $this->scanFileIsInfected = 
false;
 
  160        $this->log->write(
"ERROR (Virus Scanner failed): " 
  162            . 
"; COMMAMD=" . $cmd);
 
An exception for terminatinating execution or to throw for unit testing.
Interface to the ClamAV virus protector.
hasDetections($detectionReport)
scanFile($a_filepath, $a_origname="")
scan a file for viruses
processBufferScan($buffer)
__construct($a_scancommand, $a_cleancommand)
Constructor @access public.
buildScanCommand($file='-')
Base class for the interface to an external virus scanner This class is abstract and needs to be exte...
scanFileFromBuffer($buffer)
logScanResult()
write the result of the last scan to the log @access public