ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
VirusScannerPreProcessor.php
Go to the documentation of this file.
1 <?php
2 
4 
9 
19 final class VirusScannerPreProcessor implements PreProcessor
20 {
21 
25  protected $scanner;
26 
27 
34  {
35  $this->scanner = $scanner;
36  }
37 
38 
43  {
44  // $stream->rewind();
45  $uri = $stream->getMetadata()["uri"];
46  // chmod($uri, 0755); // we must find a way e.g. ClamAV can read the file
47  if ($this->scanner->scanFile($uri) !== "") {
48  return new ProcessingStatus(ProcessingStatus::REJECTED, 'Virus detected.');
49  }
50 
51  return new ProcessingStatus(ProcessingStatus::OK, 'No Virus detected.');
52  }
53 }
const REJECTED
Upload got rejected by a processor.
__construct(\ilVirusScanner $scanner)
VirusScannerPreProcessor constructor.
$metadata['__DYNAMIC:1__']
$stream
PHP stream implementation.
getMetadata($key=null)
Get stream metadata as an associative array or retrieve a specific key.
Base class for the interface to an external virus scanner This class is abstract and needs to be exte...
Interface FileStream.
Definition: FileStream.php:20