ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjFileUnzipFlatProcessor Class Reference

Class ilObjFileUnzipFlatProcessor. More...

+ Inheritance diagram for ilObjFileUnzipFlatProcessor:
+ Collaboration diagram for ilObjFileUnzipFlatProcessor:

Public Member Functions

 process (ResourceIdentification $rid, ?string $title=null, ?string $description=null, ?string $copyright_id=null)
 Processes a given resource for the given arguments. More...
 
- Public Member Functions inherited from ilObjFileAbstractZipProcessor
 __construct (ResourceStakeholder $stakeholder, ilObjFileGUI $gui_object, Services $storage, ilFileServicesSettings $settings, private $tree)
 
- Public Member Functions inherited from ilObjFileAbstractProcessor
 __construct (protected ResourceStakeholder $stakeholder, protected ilObjFileGUI $gui_object, protected Services $storage, protected ilFileServicesSettings $settings)
 
 getInvalidFileNames ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilObjFileAbstractZipProcessor
 createSurroundingContainer (ResourceIdentification $rid)
 
 createContainerObj (string $dir_name, int $parent_id)
 Creates a container object depending on the parent's node type and returns it. More...
 
 openZip (ResourceIdentification $rid)
 Opens the zip archive of the given resource. More...
 
 getZipFiles ()
 Yields the file-paths of the currently open zip-archive. More...
 
 hasMultipleRootEntriesInZip ()
 
 getZipDirectories ()
 Yields the directory-paths of the currently open zip-archive. More...
 
 storeZippedFile (string $file_path)
 Creates an IRSS resource from the given filepath. More...
 
 closeZip ()
 Closes the currently open zip-archive. More...
 
 isWorkspace ()
 Returns whether the current context is workspace. More...
 
- Protected Member Functions inherited from ilObjFileAbstractProcessor
 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. More...
 
- Protected Attributes inherited from ilObjFileAbstractZipProcessor
bool $create_base_container_for_multiple_root_entries = false
 Unzip on operating systems may behave differently when unzipping if there are only one or more root nodes in the zip. More...
 
- Protected Attributes inherited from ilObjFileAbstractProcessor
ilFileServicesPolicy $policy
 
ilCountPDFPages $page_counter
 
array $invalid_file_names = []
 

Detailed Description

Member Function Documentation

◆ process()

ilObjFileUnzipFlatProcessor::process ( ResourceIdentification  $rid,
?string  $title = null,
?string  $description = null,
?string  $copyright_id = null 
)

Processes a given resource for the given arguments.

Implements ilObjFileProcessorInterface.

Definition at line 28 of file class.ilObjFileUnzipFlatProcessor.php.

References ilObjFileAbstractZipProcessor\closeZip(), ilObjFileAbstractProcessor\createFileObj(), ilObjFileAbstractZipProcessor\createSurroundingContainer(), ilObjFileAbstractZipProcessor\getZipFiles(), null, ilObjFileAbstractZipProcessor\openZip(), and ilObjFileAbstractZipProcessor\storeZippedFile().

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  }
getZipFiles()
Yields the file-paths of the currently open zip-archive.
createSurroundingContainer(ResourceIdentification $rid)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
storeZippedFile(string $file_path)
Creates an IRSS resource from the given filepath.
closeZip()
Closes the currently open zip-archive.
openZip(ResourceIdentification $rid)
Opens the zip archive of the given resource.
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.
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: