VERSION
VERSION = 1.4
setExtraField(bool $setExtraField = TRUE) : mixed
Extra fields on the Zip directory records are Unix time codes needed for compatibility on the default Mac zip archive tool.
These are enabled as default, as they do no harm elsewhere and only add 26 bytes per file added.
bool | $setExtraField | TRUE (default) will enable adding of extra fields, anything else will disable it. |
addDirectory(string $directoryPath, int $timestamp, string $fileComment = null) : bool
Add an empty directory entry to the zip archive.
Basically this is only used if an empty directory is added.
string | $directoryPath | Directory Path and name to be added to the archive. |
int | $timestamp | (Optional) Timestamp for the added directory, if omitted or set to 0, the current time will be used. |
string | $fileComment | (Optional) Comment to be added to the archive for this directory. To use fileComment, timestamp must be given. |
$success
addFile(string $data, string $filePath, int $timestamp, string $fileComment = null, bool $compress = TRUE) : bool
Add a file to the archive at the specified location and file name.
string | $data | File data. |
string | $filePath | Filepath and name to be used in the archive. |
int | $timestamp | (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. |
string | $fileComment | (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. |
bool | $compress | (Optional) Compress file, if set to FALSE the file will only be stored. Default TRUE. |
$success
addDirectoryContent(string $realPath, string $zipPath, bool $recursive = TRUE, bool $followSymlinks = TRUE, array $addedFiles = array()) : mixed
Add the content to a directory.
string | $realPath | Path on the file system. |
string | $zipPath | Filepath and name to be used in the archive. |
bool | $recursive | Add content recursively, default is TRUE. |
bool | $followSymlinks | Follow and add symbolic links, if they are accessible, default is TRUE. |
array | $addedFiles | Reference to the added files, this is used to prevent duplicates, efault is an empty array. If you start the function by parsing an array, the array will be populated with the realPath and zipPath kay/value pairs added to the archive by the function. |
addLargeFile(string $dataFile, string $filePath, int $timestamp, string $fileComment = null) : bool
Add a file to the archive at the specified location and file name.
string | $dataFile | File name/path. |
string | $filePath | Filepath and name to be used in the archive. |
int | $timestamp | (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. |
string | $fileComment | (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. |
$success
openStream(string $filePath, int $timestamp, string $fileComment = null) : bool
Create a stream to be used for large entries.
string | $filePath | Filepath and name to be used in the archive. |
int | $timestamp | (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. |
string | $fileComment | (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. |
$success
getRelativePath(string $path) : string
Clean up a path, removing any unnecessary elements such as /./, // or redundant ../ segments.
If the path starts with a "/", it is deemed an absolute path and any /../ in the beginning is stripped off. The returned path will not end in a "/".
string | $path | The path to clean up |
the clean path
buildZipEntry(string $filePath, string $fileComment, string $gpFlags, string $gzType, int $timestamp, string $fileCRC32, int $gzLength, int $dataLength, int $extFileAttr) : mixed
Build the Zip file structures
string | $filePath | |
string | $fileComment | |
string | $gpFlags | |
string | $gzType | |
int | $timestamp | |
string | $fileCRC32 | |
int | $gzLength | |
int | $dataLength | |
int | $extFileAttr | Use self::EXT_FILE_ATTR_FILE for files, self::EXT_FILE_ATTR_DIR for Directories. |