ILIAS  release_7 Revision v7.30-3-g800a261c036
InlineConsumer.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
4
6
12{
13
14 public function run() : void
15 {
16 global $DIC;
17
18 $revision = $this->getRevision();
19
20 $file_name = $this->file_name_policy->prepareFileNameForConsumer($this->file_name ?? $revision->getInformation()->getTitle());
21 $mime_type = $revision->getInformation()->getMimeType();
22
23 $response = $DIC->http()->response();
24 if ($this->file_name_policy->isValidExtension($revision->getInformation()->getSuffix())) {
25 $response = $response->withHeader(ResponseHeader::CONTENT_TYPE, $mime_type);
26 } else {
27 $response = $response->withHeader(ResponseHeader::CONTENT_TYPE, 'application/octet-stream');
28 }
29 $response = $response->withHeader(ResponseHeader::CONNECTION, 'close');
31 $response = $response->withHeader(
33 'inline'
34 . '; filename="'
36 . '"'
37 );
38 $response = $response->withBody($this->storage_handler->getStream($revision));
39
40 $DIC->http()->saveResponse($response);
41 $DIC->http()->sendResponse();
42 $DIC->http()->close();
43 }
44}
An exception for terminatinating execution or to throw for unit testing.
run()
This runs the actual DeliveryConsumer.
global $DIC
Definition: goto.php:24
Interface ResponseHeader.
$response