ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
BlacklistFileHeaderPreProcessor.php
Go to the documentation of this file.
1 <?php
2 
4 
10 
21 {
23 
27  private $fileHeader;
32 
33 
39  public function __construct($fileHeader)
40  {
41  $this->stringTypeCheck($fileHeader, 'fileHeader');
42 
43  $this->fileHeaderLength = strlen($fileHeader);
44  $this->fileHeader = $fileHeader;
45  }
46 
47 
51  public function process(FileStream $stream, Metadata $metadata)
52  {
53  $header = $stream->read($this->fileHeaderLength);
54  if (strcmp($this->fileHeader, $header) !== 0) {
55  return new ProcessingStatus(ProcessingStatus::OK, 'File header does not match blacklist.');
56  }
57 
58  return new ProcessingStatus(ProcessingStatus::REJECTED, 'File header matches blacklist.');
59  }
60 }
const REJECTED
Upload got rejected by a processor.
__construct($fileHeader)
BlacklistFileHeaderPreProcessor constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface FileStream.
Definition: FileStream.php:20