ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
InlineConsumer.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
4
8
15{
16
24 private $resource;
25
26
34 {
35 $this->resource = $resource;
36 $this->storage_handler = $storage_handler;
37 }
38
39
40 public function run() : void
41 {
42 global $DIC;
43
44 $revision = $this->resource->getCurrentRevision();
45 $file_name = $revision->getInformation()->getTitle();
46 $mime_type = $revision->getInformation()->getMimeType();
47
48 $response = $DIC->http()->response();
49 $response = $response->withHeader(ResponseHeader::CONTENT_TYPE, $mime_type);
50 $response = $response->withHeader(ResponseHeader::CONNECTION, 'close');
52 $response = $response->withHeader(
54 'inline'
55 . '; filename="'
56 . $file_name
57 . '"'
58 );
59 $response = $response->withBody($this->storage_handler->getStream($revision));
60
61 $DIC->http()->saveResponse($response);
62 $DIC->http()->sendResponse();
63 $DIC->http()->close();
64 }
65}
An exception for terminatinating execution or to throw for unit testing.
run()
This runs the actual DeliveryConsumer.
__construct(StorableResource $resource, StorageHandler $storage_handler)
DownloadConsumer constructor.
Interface ResponseHeader.
$response
$DIC
Definition: xapitoken.php:46