|
| __construct () |
|
| zip (string $directory_to_zip, string $path_to_output_zip, bool $ensure_top_directory=false) |
|
| unzip (string $path_to_zip, ?string $extract_to_path=null, bool $overwrite=false, bool $flat=false, bool $ensure_top_directory=false) |
|
- Author
- Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s
- Deprecated:
- This class is deprecated and will be removed with ILIAS 10. Please use the Archives implementation instead. LegacyArchives can be used to zip individual files or directories and extract a zip file to a specified location. We should do without these possibilities as soon as possible, but for the moment very many places in ILIAS use such functionalities.
Definition at line 33 of file LegacyArchives.php.
◆ __construct()
ILIAS\Filesystem\Util\Archive\LegacyArchives::__construct |
( |
| ) |
|
Definition at line 41 of file LegacyArchives.php.
43 $this->archives =
new Archives();
44 $this->zip_options = $this->archives->zipOptions();
45 $this->unzip_options = $this->archives->unzipOptions();
◆ unzip()
ILIAS\Filesystem\Util\Archive\LegacyArchives::unzip |
( |
string |
$path_to_zip, |
|
|
?string |
$extract_to_path = null , |
|
|
bool |
$overwrite = false , |
|
|
bool |
$flat = false , |
|
|
bool |
$ensure_top_directory = false |
|
) |
| |
- Deprecated:
- Use ::unzip() instead.
Will be removed in ILIAS 10.
Definition at line 76 of file LegacyArchives.php.
References ILIAS\Filesystem\Util\Archive\FLAT_STRUCTURE.
83 $extract_to_path ??= dirname($path_to_zip);
87 $dir_handling = $ensure_top_directory ? ZipDirectoryHandling::ENSURE_SINGLE_TOP_DIR : ZipDirectoryHandling::KEEP_STRUCTURE;
90 $unzip = $this->archives->unzip(
91 Streams::ofResource(fopen($path_to_zip,
'rb')),
93 ->withZipOutputPath($extract_to_path)
94 ->withOverwrite($overwrite)
95 ->withDirectoryHandling($dir_handling)
97 return $unzip->extract();
Will keep the top directory of the ZIP file if there is one (simple unzip).
◆ zip()
ILIAS\Filesystem\Util\Archive\LegacyArchives::zip |
( |
string |
$directory_to_zip, |
|
|
string |
$path_to_output_zip, |
|
|
bool |
$ensure_top_directory = false |
|
) |
| |
- Deprecated:
- Use ::zip() instead.
Will be removed in ILIAS 10.
Definition at line 51 of file LegacyArchives.php.
56 $directory_to_zip = $this->normalizePath($directory_to_zip);
57 $path_to_output_zip = $this->normalizePath($path_to_output_zip);
59 $zip = $this->archives->zip(
62 ->withZipOutputPath(dirname($path_to_output_zip))
63 ->withZipOutputName(basename($path_to_output_zip))
64 ->withDirectoryHandling($ensure_top_directory ? ZipDirectoryHandling::ENSURE_SINGLE_TOP_DIR : ZipDirectoryHandling::KEEP_STRUCTURE)
67 $zip->addDirectory($directory_to_zip);
68 $zip_stream = $zip->get();
70 return $zip_stream->getSize() > 0;
◆ $archives
Archives ILIAS\Filesystem\Util\Archive\LegacyArchives::$archives |
|
private |
◆ $unzip_options
UnzipOptions ILIAS\Filesystem\Util\Archive\LegacyArchives::$unzip_options |
|
private |
◆ $zip_options
ZipOptions ILIAS\Filesystem\Util\Archive\LegacyArchives::$zip_options |
|
private |
The documentation for this class was generated from the following file: