ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
Interface FileStream The base interface for all filesystem streams.
Definition: FileStream.php:18
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...