ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjFileUnzipFlatProcessor.php
Go to the documentation of this file.
1<?php
2
20
27{
28 public function process(
30 ?string $title = null,
31 ?string $description = null,
32 ?string $copyright_id = null
33 ): void {
34 $this->openZip($rid);
35
36 $parent_id = $this->gui_object->getParentId();
37 // Create Base Container if needed
38 $files = iterator_to_array($this->getZipFiles());
39 $multiple_files = count($files) > 1;
40 if ($this->create_base_container_for_multiple_root_entries && $multiple_files) {
41 $parent_id = $this->createSurroundingContainer($rid);
42 }
43
44 foreach ($files as $file_path) {
45 if (substr($file_path, -1) !== DIRECTORY_SEPARATOR) {
46 $rid = $this->storeZippedFile($file_path);
47 // $file_name and $description are ignored, as flat-unzip stores the content directly
48 // within the provided parent object.
49 $file_obj = $this->createFileObj($rid, $parent_id, null, null, $copyright_id, true);
50 }
51 }
52
53 $this->closeZip();
54 }
55}
createFileObj(ResourceIdentification $rid, int $parent_id, ?string $title=null, ?string $description=null, ?string $copyright_id=null, bool $create_reference=false)
Creates an ilObjFile instance for the provided information.
Class ilObjFileAbstractZipProcessor.
createSurroundingContainer(ResourceIdentification $rid)
closeZip()
Closes the currently open zip-archive.
getZipFiles()
Yields the file-paths of the currently open zip-archive.
storeZippedFile(string $file_path)
Creates an IRSS resource from the given filepath.
openZip(ResourceIdentification $rid)
Opens the zip archive of the given resource.
Class ilObjFileUnzipFlatProcessor.
process(ResourceIdentification $rid, ?string $title=null, ?string $description=null, ?string $copyright_id=null)
Processes a given resource for the given arguments.