19 declare(strict_types=1);
43 StorableResource $resource,
44 StreamAccess $stream_access,
45 FileNamePolicy $file_name_policy
48 $this->delivery = $DIC->fileDelivery()->delivery();
54 public function run(): void
56 $revision = $this->getRevision();
57 $filename_with_extension = $this->file_name ?? $revision->getInformation()->getTitle();
58 $extension = pathinfo($filename_with_extension, PATHINFO_EXTENSION);
59 $file_name_for_consumer = $this->file_name_policy->prepareFileNameForConsumer($filename_with_extension);
61 $mime_type = $this->file_name_policy->isValidExtension($extension)
62 ? $revision->getInformation()->getMimeType()
63 : self::NON_VALID_EXTENSION_MIME;
66 $revision = $this->stream_access->populateRevision($revision);
69 'attachment' => $this->delivery->attached(
70 $revision->maybeStreamResolver()?->getStream(),
71 $file_name_for_consumer,
74 'inline' => $this->delivery->inline(
75 $revision->maybeStreamResolver()?->getStream(),
76 $file_name_for_consumer,
__construct(Services $http, StorableResource $resource, StreamAccess $stream_access, FileNamePolicy $file_name_policy)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const NON_VALID_EXTENSION_MIME
const APPLICATION__OCTET_STREAM
__construct(Container $dic, ilPlugin $plugin)
Interface DeliveryConsumer.
run()
This runs the actual DeliveryConsumer.