|
ILIAS
trunk Revision v13.0_alpha-62-g3b72d83f2e5
|
Collaboration diagram for ILIAS\Filesystem\Util\Archive\Unzip:Public Member Functions | |
| __construct (protected UnzipOptions $options, FileStream $stream) | |
| Only the path of the passed stream is used, the stream itself is not kept. More... | |
| close () | |
| Releases the file handle of the ZIP-file. More... | |
| getPaths () | |
| getStreams () | |
| getFileStreams () | |
| getAmountOfDirectories () | |
| getDirectories () | |
| Yields the directory-paths of the currently open zip-archive. More... | |
| getAmountOfFiles () | |
| getFiles () | |
| Yields the file-paths of the currently open zip-archive. More... | |
| hasMultipleRootEntriesInZip () | |
| isWithinLimits () | |
| Guards against decompression bombs by checking the archive metadata (entry count, total uncompressed size and the uncompressed/compressed ratio) before any data is handed out. More... | |
| extract () | |
| Extracting is the last operation on the archive in almost all cases, therefore the file handle of the ZIP-file is released afterwards, so the ZIP-file and its directory can be deleted immediately (which otherwise fails on e.g. More... | |
| hasZipReadingError () | |
Data Fields | |
| const | DS_UNIX = "/" |
| const | DS_WIN = "\\" |
| const | BASE_DIR = '.' |
Protected Member Functions | |
| pathToStreamGenerator () | |
Protected Attributes | |
| const | URI = 'uri' |
| const | DIRECTORY_SEPARATOR = DIRECTORY_SEPARATOR |
| ZipArchive | $zip |
| bool | $error_reading_zip = false |
| string | $path_to_zip |
Private Member Functions | |
| open () | |
| calculateIsWithinLimits () | |
| extractAndKeepOpen () | |
Private Attributes | |
| bool | $is_open = false |
| int | $amount_of_entries = 0 |
| bool | $within_limits = null |
| ILIAS\Filesystem\Util\Archive\Unzip::__construct | ( | protected UnzipOptions | $options, |
| FileStream | $stream | ||
| ) |
Only the path of the passed stream is used, the stream itself is not kept.
This way a stream which is created just for the Unzip (e.g. Streams::ofResource(fopen(...))) is closed right away and does not keep the ZIP-file open.
Definition at line 51 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\open().
Here is the call graph for this function:
|
private |
Definition at line 250 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\$amount_of_entries, ILIAS\Filesystem\Util\Archive\Unzip\open(), and ILIAS\Filesystem\Util\Archive\UnzipOptions\UNLIMITED.
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\isWithinLimits().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::close | ( | ) |
Releases the file handle of the ZIP-file.
extract() does this on its own, consumers which only read paths or streams can call this as soon as they are done, e.g. before deleting the ZIP-file. The archive is opened again if it is accessed after it has been closed.
Definition at line 85 of file Unzip.php.
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\extract().
Here is the caller graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::extract | ( | ) |
Extracting is the last operation on the archive in almost all cases, therefore the file handle of the ZIP-file is released afterwards, so the ZIP-file and its directory can be deleted immediately (which otherwise fails on e.g.
NFS as long as the file is open).
Definition at line 295 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\close(), and ILIAS\Filesystem\Util\Archive\Unzip\extractAndKeepOpen().
Here is the call graph for this function:
|
private |
Definition at line 304 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\FLAT_STRUCTURE, ILIAS\Filesystem\Util\Archive\Unzip\getPaths(), ILIAS\Filesystem\Util\Archive\Unzip\getStreams(), ILIAS\Filesystem\Util\Archive\Unzip\isWithinLimits(), ILIAS\Filesystem\Util\Archive\Unzip\open(), and ILIAS\Filesystem\Util\sanitizeFileName().
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\extract().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::getAmountOfDirectories | ( | ) |
Definition at line 151 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\getDirectories().
Here is the call graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::getAmountOfFiles | ( | ) |
Definition at line 189 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\getFiles().
Here is the call graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::getDirectories | ( | ) |
Yields the directory-paths of the currently open zip-archive.
This fixes the issue that win and mac zip archives have different directory structures.
Definition at line 161 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\DIRECTORY_SEPARATOR, ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), ILIAS\Filesystem\Util\Archive\Unzip\getPaths(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\getAmountOfDirectories(), and ILIAS\Filesystem\Util\Archive\Unzip\hasMultipleRootEntriesInZip().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::getFiles | ( | ) |
Yields the file-paths of the currently open zip-archive.
Definition at line 198 of file Unzip.php.
References $files, ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), ILIAS\Filesystem\Util\Archive\Unzip\getPaths(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\getAmountOfFiles(), ILIAS\Filesystem\Util\Archive\Unzip\getFileStreams(), ILIAS\Filesystem\Util\Archive\Unzip\getStreams(), and ILIAS\Filesystem\Util\Archive\Unzip\hasMultipleRootEntriesInZip().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::getFileStreams | ( | ) |
Definition at line 144 of file Unzip.php.
References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), ILIAS\Filesystem\Util\Archive\Unzip\getFiles(), and ILIAS\Filesystem\Util\Archive\Unzip\pathToStreamGenerator().
Here is the call graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::getPaths | ( | ) |
Definition at line 114 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\isWithinLimits(), and ILIAS\Filesystem\Util\Archive\Unzip\open().
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\extractAndKeepOpen(), ILIAS\Filesystem\Util\Archive\Unzip\getDirectories(), ILIAS\Filesystem\Util\Archive\Unzip\getFiles(), and ILIAS\Filesystem\Util\Archive\Unzip\getStreams().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::getStreams | ( | ) |
Definition at line 130 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\FLAT_STRUCTURE, ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), ILIAS\Filesystem\Util\Archive\Unzip\getFiles(), ILIAS\Filesystem\Util\Archive\Unzip\getPaths(), and ILIAS\Filesystem\Util\Archive\Unzip\pathToStreamGenerator().
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\extractAndKeepOpen().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::hasMultipleRootEntriesInZip | ( | ) |
Definition at line 210 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\getDirectories(), and ILIAS\Filesystem\Util\Archive\Unzip\getFiles().
Here is the call graph for this function:| ILIAS\Filesystem\Util\Archive\Unzip::hasZipReadingError | ( | ) |
Definition at line 364 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\$error_reading_zip.
| ILIAS\Filesystem\Util\Archive\Unzip::isWithinLimits | ( | ) |
Guards against decompression bombs by checking the archive metadata (entry count, total uncompressed size and the uncompressed/compressed ratio) before any data is handed out.
The sizes are read from the central directory via statIndex(); a crafted archive that lies about these sizes fails during the subsequent extraction anyway.
An archive that exceeds the limits behaves like an empty one: extract() returns false and all generators (getPaths(), getFiles(), getStreams(), getFileStreams(), ...) yield nothing. Callers that consume the streams themselves should ask this method first, so they can tell a rejected archive from an empty one and report it to the user.
Definition at line 245 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\calculateIsWithinLimits().
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\extractAndKeepOpen(), and ILIAS\Filesystem\Util\Archive\Unzip\getPaths().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 62 of file Unzip.php.
References ILIAS\Filesystem\Util\Archive\Unzip\$is_open.
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\__construct(), ILIAS\Filesystem\Util\Archive\Unzip\calculateIsWithinLimits(), ILIAS\Filesystem\Util\Archive\Unzip\extractAndKeepOpen(), ILIAS\Filesystem\Util\Archive\Unzip\getPaths(), and ILIAS\Filesystem\Util\Archive\Unzip\pathToStreamGenerator().
Here is the caller graph for this function:
|
protected |
Definition at line 97 of file Unzip.php.
References ILIAS\Filesystem\Stream\Streams\ofResource(), and ILIAS\Filesystem\Util\Archive\Unzip\open().
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\getFileStreams(), and ILIAS\Filesystem\Util\Archive\Unzip\getStreams().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 43 of file Unzip.php.
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\calculateIsWithinLimits().
|
protected |
Definition at line 40 of file Unzip.php.
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\hasZipReadingError().
|
private |
Definition at line 42 of file Unzip.php.
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\open().
|
protected |
|
private |
|
protected |
|
protected |
Definition at line 35 of file Unzip.php.
Referenced by ILIAS\Filesystem\Util\Archive\Unzip\getDirectories().
|
protected |