19 declare(strict_types=1);
44 public function __construct(
protected array
$resources,
private StreamAccess $stream_access,
protected FileNamePolicy $file_name_policy,
protected string $zip_file_name)
49 public function run(): void
54 $temp = tempnam($directory,
'zip');
55 $zip = new \ZipArchive();
56 $zip->open($temp, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
59 $revision = $this->stream_access->populateRevision($resource->getCurrentRevision());
60 if ($this->use_revision_titles) {
61 $file_name = $this->file_name_policy->prepareFileNameForConsumer($revision->getTitle());
63 $file_name = $this->file_name_policy->prepareFileNameForConsumer(
64 $revision->getInformation()->getTitle()
68 $zip->addFile($revision->maybeStreamResolver()->getStream()->getMetadata(
'uri'), $file_name);
80 . $this->zip_file_name
83 $fopen = fopen($temp,
'rb');
86 $DIC->http()->sendResponse();
89 $DIC->http()->close();
107 $this->zip_file_name = $file_name;
ResourceCollection $collection
setRevisionNumber(int $revision_number)
bool $use_revision_titles
__construct(protected array $resources, private StreamAccess $stream_access, protected FileNamePolicy $file_name_policy, protected string $zip_file_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
overrideFileName(string $file_name)
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
useRevisionTitlesForFileNames(bool $use_revision_titles)
Interface DeliveryConsumer.
run()
This runs the actual DeliveryConsumer.