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)
46 if( function_exists($func) )
77 $descriptorspec = array(
78 0 => array(
"pipe",
"r"),
79 1 => array(
"pipe",
"w"),
80 2 => array(
"pipe",
"w")
89 if( !is_resource($process) )
94 fwrite($pipes[0], $buffer);
97 $detectionReport = stream_get_contents($pipes[1]);
100 $errorReport = stream_get_contents($pipes[2]);
103 $return = proc_close($process);
114 return preg_match(
"/FOUND/", $detectionReport);
136 $this->scanFilePath = $a_filepath;
137 $this->scanFileOrigName = $a_origname;
142 $this->scanResult = implode(
"\n",
$out);
147 $this->scanFileIsInfected =
true;
153 $this->scanFileIsInfected =
false;
158 $this->log->write(
"ERROR (Virus Scanner failed): "
160 .
"; 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
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file