Archive final class
Minn\Ops\Archive · public/minn/src/Minn/Ops/Archive.php · 105 lines
A zip unpacked the safe way, for the plugin and theme installer and for the engine's own update alike: every entry stays inside its folder (no absolute path, no "..", no backslash, no NUL), none is a symbolic link, there are no more than 20,000 of them, they unpack to no more than 512 MB, and they all sit in exactly one top folder (macOS's __MACOSX noise aside). Nothing is written until every entry has passed.
Constants and properties
| const | MAX_BYTES = 536870912 | |
| private | MAX_ENTRIES = 20000 |
Public
| static | unpackFolder(string $file, string $stage): string# | Unpacks a zip file into a new folder $stage; the path of the one folder the archive held. |
| static | inspect(string $file): string# | Checks every entry of a zip file without writing anything; the one folder it holds. |
| static | holds(string $file, string $entry): bool# | Whether a zip file holds an entry by that name. |
| static | isFolderName(string $name): bool# | A plain folder name: no separators, never "." or "..". |
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | isSymlinkEntry(ZipArchive $archive, int $index): bool# | Whether a zip entry is recorded as a symbolic link (a Unix entry whose mode says so). |
Nothing matches.