ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilVirusScannerPreProcessor.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 
27 {
29 
30  public function __construct(ilVirusScanner $scanner)
31  {
32  $this->scanner = $scanner;
33  }
34 
35  public function process(FileStream $stream, Metadata $metadata): ProcessingStatus
36  {
37  $uri = $stream->getMetadata()['uri'];
38  // chmod($uri, 0755); // we must find a way e.g. ClamAV can read the file
39  if ($this->scanner->scanFile($uri) !== '') {
40  return new ProcessingStatus(ProcessingStatus::DENIED, 'Virus detected.');
41  }
42 
43  return new ProcessingStatus(ProcessingStatus::OK, 'No Virus detected.');
44  }
45 }
process(FileStream $stream, Metadata $metadata)
The base interface for all filesystem streams.
Definition: FileStream.php:31