19 declare(strict_types=1);
35 private \ILIAS\HTTP\Services
$http;
36 private \ILIAS\FileDelivery\Delivery\StreamDelivery
$delivery;
45 $this->delivery = $DIC->fileDelivery()->delivery();
51 public function run(): void
53 $revision = $this->getRevision();
54 $filename_with_extension = $this->file_name ?? $revision->getInformation()->getTitle();
55 $extension = pathinfo($filename_with_extension, PATHINFO_EXTENSION);
56 $file_name_for_consumer = $this->file_name_policy->prepareFileNameForConsumer($filename_with_extension);
58 $mime_type = $this->file_name_policy->isValidExtension($extension)
59 ? $revision->getInformation()->getMimeType()
60 : self::NON_VALID_EXTENSION_MIME;
63 $revision = $this->stream_access->populateRevision($revision);
67 $this->delivery->attached(
68 $revision->maybeStreamResolver()?->getStream(),
69 $file_name_for_consumer,
74 $this->delivery->inline(
75 $revision->maybeStreamResolver()?->getStream(),
76 $file_name_for_consumer,
81 throw new \InvalidArgumentException(
'Invalid disposition');
__construct(\ILIAS\HTTP\Services $http, StorableResource $resource, StreamAccess $stream_access, FileNamePolicy $file_name_policy)
Interface StorageResource.
ILIAS HTTP Services $http
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
run()
This runs the actual DeliveryConsumer.
StorableResource $resource
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface FileNamePolicy.
ILIAS FileDelivery Delivery StreamDelivery $delivery
StreamAccess $stream_access
const NON_VALID_EXTENSION_MIME
const APPLICATION__OCTET_STREAM
Interface DeliveryConsumer.
FileNamePolicy $file_name_policy