ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Repository\Resources\ZipAdapter Class Reference
+ Collaboration diagram for ILIAS\Repository\Resources\ZipAdapter:

Public Member Functions

 __construct (Archives $archives, LegacyArchives $legacy_archives)
 
 unzipFile (string $filepath)
 
 zipDirectoryToFile (string $directory, string $zip_file)
 

Protected Attributes

Archives $archives
 
LegacyArchives $legacy_archives
 

Detailed Description

Definition at line 30 of file ZipAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Repository\Resources\ZipAdapter::__construct ( Archives  $archives,
LegacyArchives  $legacy_archives 
)

Definition at line 35 of file ZipAdapter.php.

38 {
39 $this->archives = $archives;
40 $this->legacy_archives = $legacy_archives;
41 }

References ILIAS\Repository\Resources\ZipAdapter\$archives, and ILIAS\Repository\Resources\ZipAdapter\$legacy_archives.

Member Function Documentation

◆ unzipFile()

ILIAS\Repository\Resources\ZipAdapter::unzipFile ( string  $filepath)

Definition at line 43 of file ZipAdapter.php.

43 : void
44 {
45 $unzip = $this->archives->unzip(
46 Streams::ofResource(fopen($filepath, 'rb')),
47 $this->archives->unzipOptions()
48 ->withZipOutputPath(dirname($filepath))
49 ->withOverwrite(false)
50 ->withDirectoryHandling(ZipDirectoryHandling::KEEP_STRUCTURE)
51 );
52 if (!$unzip->extract()) {
53 throw new ilException("Unzip failed.");
54 }
55 }
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
Definition: Streams.php:64
Base class for ILIAS Exception handling.

References ILIAS\Filesystem\Stream\Streams\ofResource().

+ Here is the call graph for this function:

◆ zipDirectoryToFile()

ILIAS\Repository\Resources\ZipAdapter::zipDirectoryToFile ( string  $directory,
string  $zip_file 
)

Definition at line 57 of file ZipAdapter.php.

57 : void
58 {
59 $this->legacy_archives->zip(
60 $directory,
61 $zip_file,
62 true
63 );
64 }

Field Documentation

◆ $archives

Archives ILIAS\Repository\Resources\ZipAdapter::$archives
protected

Definition at line 32 of file ZipAdapter.php.

Referenced by ILIAS\Repository\Resources\ZipAdapter\__construct().

◆ $legacy_archives

LegacyArchives ILIAS\Repository\Resources\ZipAdapter::$legacy_archives
protected

Definition at line 33 of file ZipAdapter.php.

Referenced by ILIAS\Repository\Resources\ZipAdapter\__construct().


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