tarEntries.php
Table of Contents
Functions
- tarEntries() : array<int, array{base: string, name: string, directory: bool, path: string}>
- Works out what an archive is to contain, and under which names.
- tarEntriesByBase() : array<string, array<int, string>>
- Groups entries by the directory their names are relative to.
Functions
tarEntries()
Works out what an archive is to contain, and under which names.
tarEntries(array<string|int, string> $paths[, string|null $preserveRoot = null ]) : array<int, array{base: string, name: string, directory: bool, path: string}>
Written once and used by both engines, because the naming is the whole compatibility contract: an archive is only interchangeable with the ones written before it if the entries are called the same thing. Two copies of these rules would drift, and the drift would only show up the day someone tried to restore an old backup.
Each entry carries the directory it is named relative to, so the caller can either add it to
a PharData or hand the list to tar -C <base>.
Parameters
- $paths : array<string|int, string>
-
The real paths to archive, each proven to exist.
- $preserveRoot : string|null = null
-
The directory names are taken relative to, when given.
Tags
Return values
array<int, array{base: string, name: string, directory: bool, path: string}> —base is what name is relative to, path is where the content really is.
tarEntriesByBase()
Groups entries by the directory their names are relative to.
tarEntriesByBase(array<int, array{base: string, name: string, directory: bool, path: string}> $entries) : array<string, array<int, string>>
tar is told a base with -C and reads the names from standard input, so one invocation
covers one base. Archiving several unrelated paths at once therefore takes several.
Parameters
- $entries : array<int, array{base: string, name: string, directory: bool, path: string}>
Tags
Return values
array<string, array<int, string>> —The names to archive, keyed by base directory.