134 $this->scanCommand = $a_scancommand;
135 $this->cleanCommand = $a_cleancommand;
137 $this->type =
"simulate";
138 $this->scanZipFiles =
false;
157 $isInfected = $this->
scanFile($bufferFile);
169 file_put_contents($bufferFile, $buffer);
204 $this->scanFilePath = $a_filepath;
205 $this->scanFileOrigName = $a_origname;
207 if($a_origname ==
"infected.txt" or $a_origname ==
"cleanable.txt")
209 $this->scanFileIsInfected =
true;
211 "FILE INFECTED: [" . $a_filepath .
"] (VIRUS: simulated)";
217 $this->scanFileIsInfected =
false;
218 $this->scanResult =
"";
246 $this->cleanFilePath = $a_filepath;
247 $this->cleanFileOrigName = $a_origname;
249 if($a_origname ==
"cleanable.txt")
251 $this->cleanFileIsCleaned =
true;
253 "FILE CLEANED: [" . $a_filepath .
"] (VIRUS: simulated)";
259 $this->cleanFileIsCleaned =
false;
261 "FILE NOT CLEANED: [" . $a_filepath .
"] (VIRUS: simulated)";
282 $mess =
"Virus Scanner (" . $this->type .
")";
283 if($this->scanFileOrigName)
285 $mess .=
" (File " . $this->scanFileOrigName .
")";
287 $mess .=
": " . preg_replace(
'/[\r\n]+/',
"; ", $this->scanResult);
289 $this->log->write($mess);
298 $mess =
"Virus Cleaner (" . $this->type .
")";
299 if($this->cleanFileOrigName)
301 $mess .=
" (File " . $this->cleanFileOrigName .
")";
303 $mess .=
": " . preg_replace(
'/[\r\n]+/',
"; ", $this->cleanResult);
305 $this->log->write($mess);
335 if($this->scanFileIsInfected)
337 $ret =
sprintf($this->lng->txt(
"virus_infected"), $this->scanFileOrigName);
341 $ret =
sprintf($this->lng->txt(
"virus_not_infected"), $this->scanFileOrigName);
344 if($this->scanResult)
346 $ret .=
" " . $this->lng->txt(
"virus_scan_message")
348 . str_replace($this->scanFilePath, $this->scanFileOrigName,
349 nl2br($this->scanResult));
361 if($this->cleanFileIsCleaned)
363 $ret =
sprintf($this->lng->txt(
"virus_cleaned"), $this->cleanFileOrigName);
367 $ret =
sprintf($this->lng->txt(
"virus_not_cleaned"), $this->cleanFileOrigName);
370 if($this->cleanResult)
372 $ret .=
" " . $this->lng->txt(
"virus_clean_message")
374 . str_replace($this->cleanFilePath, $this->cleanFileOrigName,
375 nl2br($this->cleanResult));
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
Base class for the interface to an external virus scanner This class is abstract and needs to be exte...
getCleanMessage()
get a located message with the result from the last clean
scanFileFromBuffer($buffer)
logScanResult()
write the result of the last scan to the log @access public
scanFile($a_filepath, $a_origname="")
scan a file for viruses needs to be redefined in child classes here it simulates a scan "infected....
__construct($a_scancommand, $a_cleancommand)
Constructor @access public.
getScanResult()
get the pure output of the external scan
logCleanResult()
write the result of the last clean to the log @access public
removeBufferFile($bufferFile)
getScanZipFiles()
get info if class can scan ZIP files
getCleanResult()
get the pure output of the external scan
cleanFile($a_filepath, $a_origname="")
clean an infected file needs to be redefined in child classes here it simulates a clean "cleanable....
getScanMessage()
get a located message with the result from the last scan
fileCleaned()
returns wether file has been cleaned successfully or not
createBufferFile($buffer)
redirection script todo: (a better solution should control the processing via a xml file)