Skip to content

Commit

Permalink
export to irss, adjustments for component Test in export
Browse files Browse the repository at this point in the history
  • Loading branch information
chlulei committed Oct 14, 2024
1 parent ef5515b commit 1bb95f1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
27 changes: 19 additions & 8 deletions components/ILIAS/Export/classes/ExportHandler/Manager/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,24 @@ public function createContainerExport(
$main_element = $this->createExport($user_id, $main_export_info, "set_" . $main_export_info->getSetNumber());
$repository = $this->export_handler->repository();
foreach ($container_export_info->getExportInfos() as $export_info) {
$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;
$zip_reader = new ZipReader($element->getIRSSInfo()->getStream());
# Test special case (Test does not return a xml export), does something different
$stream = null;
if ($export_info->getTarget()->getType() === "tst") {
$this->createExport($user_id, $export_info, "");
$stream = Streams::ofResource(fopen($export_info->getLegacyExportRunDir() . ".zip", 'r'));
}
if ($export_info->getTarget()->getType() !== "tst") {
$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) {
if ($item['is_dir']) {
Expand Down Expand Up @@ -162,6 +172,7 @@ public function createExport(
# tmp solution, remove later if no longer needed
ilFileUtils::delDir($export_info->getLegacyExportRunDir());

# Test special case
# Remove export if the component is Test
if ($export_info->getTarget()->getType() === "tst") {
$keys = $this->export_handler->repository()->key()->collection()
Expand Down
4 changes: 4 additions & 0 deletions components/ILIAS/Export/classes/class.ilExportGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ protected function builtExportOptionCommand(ilExportHandlerConsumerExportOptionI

protected function enableStandardXMLExport(): void
{
# Exception for Test
if ($this->obj->getType() === "tst") {
return;
}
$this->export_options = $this->export_options->withElement(new ilExportExportOptionXML());
}

Expand Down

0 comments on commit 1bb95f1

Please sign in to comment.