Horde_Compress_Tar
extends Horde_Compress_Base
in package
This class allows tar files to be read.
Tags
Table of Contents
- $canCompress : bool
- Does this driver support compressing data?
- $canDecompress : bool
- Does this driver support decompressing data?
- $_logger : Horde_Log_Logger
- Logger
- $_tmp : resource
- Temporary contents for compressing files.
- $_types : array<string|int, mixed>
- Tar file types.
- __construct() : mixed
- Constructor.
- compress() : mixed
- Compresses the data.
- compressDirectory() : mixed
- Compresses a directory.
- decompress() : array<string|int, mixed>
- Decompresses the data.
- _formatNumber() : string
- Formats a number from the file information for the TAR format.
- _getLink() : string
- Returns the relative path of a symbolic link
Properties
$canCompress
Does this driver support compressing data?
public
bool
$canCompress
= \true
$canDecompress
Does this driver support decompressing data?
public
bool
$canDecompress
= \true
$_logger
Logger
protected
Horde_Log_Logger
$_logger
$_tmp
Temporary contents for compressing files.
protected
resource
$_tmp
$_types
Tar file types.
protected
array<string|int, mixed>
$_types
= array(0x0 => 'Unix file', 0x30 => 'File', 0x31 => 'Link', 0x32 => 'Symbolic link', 0x33 => 'Character special file', 0x34 => 'Block special file', 0x35 => 'Directory', 0x36 => 'FIFO special file', 0x37 => 'Contiguous file')
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
-
Additional options for the compressor backend.
Return values
mixed —compress()
Compresses the data.
public
compress(array<string|int, mixed> $data[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $data : array<string|int, mixed>
-
The data to compress. Requires an array of arrays. Each subarray should contain these fields:
- data: (string/resource) The data to compress.
- name: (string) The pathname to the file.
- time: (integer) [optional] The timestamp to use for the file.
- spl: (SplFileInfo) [optional] Complete file information.
- $params : array<string|int, mixed> = array()
-
The parameter array.
- stream: (boolean) If set, return a stream instead of a string. DEFAULT: Return string
Tags
Return values
mixed —The TAR file as either a string or a stream resource.
compressDirectory()
Compresses a directory.
public
compressDirectory(string $directory[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $directory : string
-
The directory to recursively compress.
- $params : array<string|int, mixed> = array()
-
An array of arguments needed to compress the data.
Tags
Return values
mixed —The compressed data.
decompress()
Decompresses the data.
public
decompress(mixed $data[, array<string|int, mixed> $params = array() ]) : array<string|int, mixed>
Parameters
- $data : mixed
-
The data to decompress.
- $params : array<string|int, mixed> = array()
-
An array of arguments needed to decompress the data.
Tags
Return values
array<string|int, mixed> —Tar file data:
KEY: Position in the array VALUES: attr - File attributes data - Raw file contents date - File modification time name - Filename size - Original file size type - File type
_formatNumber()
Formats a number from the file information for the TAR format.
protected
_formatNumber(array<string|int, mixed> $file, string $method) : string
Parameters
- $file : array<string|int, mixed>
-
A file hash from compress() that may include a 'spl' entry with an .
- $method : string
-
The method of the SplFileInfo object that returns the requested number.
Return values
string —The correctly formatted number.
_getLink()
Returns the relative path of a symbolic link
protected
_getLink(SplFileInfo $spl) : string
Parameters
- $spl : SplFileInfo
-
An SplFileInfo object.
Return values
string —The relative path of the symbolic link.