ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
VirusScannerPreProcessor.php
Go to the documentation of this file.
1<?php
2
4
8use Psr\Http\Message\StreamInterface;
9
20{
21
25 protected $scanner;
26
27
34 {
35 $this->scanner = $scanner;
36 }
37
38
42 public function process(FileStream $stream, Metadata $metadata)
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}
An exception for terminatinating execution or to throw for unit testing.
const REJECTED
Upload got rejected by a processor.
__construct(\ilVirusScanner $scanner)
VirusScannerPreProcessor constructor.
process(FileStream $stream, Metadata $metadata)
@inheritDoc
Base class for the interface to an external virus scanner This class is abstract and needs to be exte...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...