Skip to content

Commit

Permalink
10 mantis ilias 42692
Browse files Browse the repository at this point in the history
  • Loading branch information
chlulei committed Nov 14, 2024
1 parent cf040fe commit 1f38cbd
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions components/ILIAS/Export/classes/ExportHandler/Manager/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,15 @@ public function createContainerExport(
$repository = $this->export_handler->repository();
foreach ($container_export_info->getExportInfos() as $export_info) {
$stream = null;
# Test, TestQuestionPool special case (Test does not return a xml export)
$special_case = in_array($export_info->getTarget()->getType(), ["tst", "qpl"]);
if ($special_case) {
$this->createExport($user_id, $export_info, "");
$stream = Streams::ofResource(fopen($export_info->getLegacyExportRunDir() . ".zip", 'r'));
}
if (!$special_case) {
$keys = $repository->key()->collection()
->withElement($repository->key()->handler()->withObjectId($export_info->getTargetObjectId()));
$element = $export_info->getReuseExport()
? $this->export_handler->repository()->handler()->getElements($keys)->newest()
: $this->createExport($user_id, $export_info, "");
$element = $element->getIRSS()->isContainerExport()
? $this->createExport($user_id, $export_info, "")
: $element;
$stream = $element->getIRSSInfo()->getStream();
}
$keys = $repository->key()->collection()
->withElement($repository->key()->handler()->withObjectId($export_info->getTargetObjectId()));
$element = $export_info->getReuseExport()
? $this->export_handler->repository()->handler()->getElements($keys)->newest()
: $this->createExport($user_id, $export_info, "");
$element = $element->getIRSS()->isContainerExport()
? $this->createExport($user_id, $export_info, "")
: $element;
$stream = $element->getIRSSInfo()->getStream();
$zip_reader = new ZipReader($stream);
$zip_structure = $zip_reader->getStructure();
foreach ($zip_structure as $path_inside_zip => $item) {
Expand Down Expand Up @@ -176,17 +168,6 @@ public function createExport(
# delete legacy export run dir
# tmp solution, remove if no longer needed
ilFileUtils::delDir($export_info->getLegacyExportRunDir());

# Test special case
# Remove export if the component is Test, TestQuestionPool
if (in_array($export_info->getTarget()->getType(), ["tst", "qpl"])) {
$keys = $this->export_handler->repository()->key()->collection()
->withElement($element->getKey());
$this->export_handler->repository()->handler()->deleteElements(
$keys,
$stakeholder
);
}
return $element;
}

Expand Down

0 comments on commit 1f38cbd

Please sign in to comment.