ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilVirusScannerPreProcessor.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25
27{
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...
The base interface for all filesystem streams.
Definition: FileStream.php:32