ILIAS  release_8 Revision v8.24
class.ilVirusScannerPreProcessor.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25
27{
28 protected \ilVirusScanner $scanner;
29
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)
This method gets invoked by the file upload service to process the file with the help of the processo...