19 declare(strict_types=1);
63 public function run(): void
68 $temp = tempnam($directory,
'zip');
69 $zip = new \ZipArchive();
70 $zip->open($temp, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
72 foreach ($this->resources as $resource) {
73 $revision = $this->stream_access->populateRevision($resource->getCurrentRevision());
74 if ($this->use_revision_titles) {
75 $file_name = $this->file_name_policy->prepareFileNameForConsumer($revision->getTitle());
77 $file_name = $this->file_name_policy->prepareFileNameForConsumer(
78 $revision->getInformation()->getTitle()
82 $zip->addFile($revision->maybeGetToken()->resolveStream()->getMetadata(
'uri'), $file_name);
94 . $this->zip_file_name
97 $fopen = fopen($temp,
'rb');
100 $DIC->http()->sendResponse();
103 $DIC->http()->close();
121 $this->zip_file_name = $file_name;
setRevisionNumber(int $revision_number)
StreamAccess $stream_access
overrideFileName(string $file_name)
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...
Class ResourceCollection.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface FileNamePolicy.
bool $use_revision_titles
useRevisionTitlesForFileNames(bool $use_revision_titles)
__construct(array $resources, StreamAccess $stream_access, FileNamePolicy $file_name_policy, string $zip_file_name)
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
ResourceCollection $collection
FileNamePolicy $file_name_policy
Interface DeliveryConsumer.
run()
This runs the actual DeliveryConsumer.