137        $this->scanCommand  = $a_scancommand;
 
  138        $this->cleanCommand = $a_cleancommand;
 
  140        $this->type         = 
"simulate";
 
  141        $this->scanZipFiles = 
false;
 
  160        $isInfected = $this->
scanFile($bufferFile);
 
  172        file_put_contents($bufferFile, $buffer);
 
  194    public function scanFile($a_filepath, $a_origname = 
"")
 
  207        $this->scanFilePath     = $a_filepath;
 
  208        $this->scanFileOrigName = $a_origname;
 
  210        if ($a_origname == 
"infected.txt" or $a_origname == 
"cleanable.txt") {
 
  211            $this->scanFileIsInfected = 
true;
 
  213                "FILE INFECTED: [" . $a_filepath . 
"] (VIRUS: simulated)";
 
  217            $this->scanFileIsInfected = 
false;
 
  218            $this->scanResult         = 
"";
 
  233    public function cleanFile($a_filepath, $a_origname = 
"")
 
  246        $this->cleanFilePath     = $a_filepath;
 
  247        $this->cleanFileOrigName = $a_origname;
 
  249        if ($a_origname == 
"cleanable.txt") {
 
  250            $this->cleanFileIsCleaned = 
true;
 
  252                "FILE CLEANED: [" . $a_filepath . 
"] (VIRUS: simulated)";
 
  256            $this->cleanFileIsCleaned = 
false;
 
  258                "FILE NOT CLEANED: [" . $a_filepath . 
"] (VIRUS: simulated)";
 
  279        $mess = 
"Virus Scanner (" . $this->type . 
")";
 
  280        if ($this->scanFileOrigName) {
 
  281            $mess .= 
" (File " . $this->scanFileOrigName . 
")";
 
  283        $mess .= 
": " . preg_replace(
'/[\r\n]+/', 
"; ", $this->scanResult);
 
  285        $this->log->write($mess);
 
  294        $mess = 
"Virus Cleaner (" . $this->type . 
")";
 
  295        if ($this->cleanFileOrigName) {
 
  296            $mess .= 
" (File " . $this->cleanFileOrigName . 
")";
 
  298        $mess .= 
": " . preg_replace(
'/[\r\n]+/', 
"; ", $this->cleanResult);
 
  300        $this->log->write($mess);
 
  330        if ($this->scanFileIsInfected) {
 
  331            $ret = 
sprintf($this->lng->txt(
"virus_infected"), $this->scanFileOrigName);
 
  333            $ret = 
sprintf($this->lng->txt(
"virus_not_infected"), $this->scanFileOrigName);
 
  336        if ($this->scanResult) {
 
  337            $ret .= 
" " . $this->lng->txt(
"virus_scan_message")
 
  341                    $this->scanFileOrigName,
 
  342                    nl2br($this->scanResult)
 
  355        if ($this->cleanFileIsCleaned) {
 
  356            $ret = 
sprintf($this->lng->txt(
"virus_cleaned"), $this->cleanFileOrigName);
 
  358            $ret = 
sprintf($this->lng->txt(
"virus_not_cleaned"), $this->cleanFileOrigName);
 
  361        if ($this->cleanResult) {
 
  362            $ret .= 
" " . $this->lng->txt(
"virus_clean_message")
 
  365                    $this->cleanFilePath,
 
  366                    $this->cleanFileOrigName,
 
  367                    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)