ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjFileUnzipFlatProcessor.php
Go to the documentation of this file.
1 <?php
2 
20 
27 {
28  public function process(ResourceIdentification $rid, array $options = []): void
29  {
30  $this->openZip($rid);
31 
32  $parent_id = $this->gui_object->getParentId();
33  // Create Base Container if needed
34  $files = iterator_to_array($this->getZipFiles());
35  $multiple_files = count($files) > 1;
36  if ($this->create_base_container_for_multiple_root_entries && $multiple_files) {
37  $parent_id = $this->createSurroundingContainer($rid);
38  }
39 
40  foreach ($files as $file_path) {
41  if (substr($file_path, -1) !== DIRECTORY_SEPARATOR) {
42  $rid = $this->storeZippedFile($file_path);
43  // $options is ignored, as flat-unzip stores the content directly
44  // within the provided parent object.
45 
46  $this->createFileObj($rid, $parent_id, [], true);
47  }
48  }
49 
50  $this->closeZip();
51  }
52 }
getZipFiles()
Yields the file-paths of the currently open zip-archive.
createSurroundingContainer(ResourceIdentification $rid)
createFileObj(ResourceIdentification $rid, int $parent_id, array $options=[], bool $create_reference=false)
Creates an ilObjFile instance for the provided information.
Class ilObjFileAbstractZipProcessor.
storeZippedFile(string $file_path)
Creates an IRSS resource from the given filepath.
process(ResourceIdentification $rid, array $options=[])
Processes a given resource for the given arguments.
closeZip()
Closes the currently open zip-archive.
openZip(ResourceIdentification $rid)
Opens the zip archive of the given resource.
Class ilObjFileUnzipFlatProcessor.