\Horde_Compress_Tar

This class allows tar files to be read.

Summary

Methods
Properties
Constants
__construct()
compress()
compressDirectory()
decompress()
$canCompress
$canDecompress
No constants found
_getLink()
_formatNumber()
$_logger
$_types
$_tmp
N/A
No private methods found
No private properties found
N/A

Properties

$canCompress

$canCompress : boolean

Does this driver support compressing data?

Type

boolean

$canDecompress

$canDecompress : boolean

Does this driver support decompressing data?

Type

boolean

$_logger

$_logger : \Horde_Log_Logger

Logger

Type

\Horde_Log_Logger

$_types

$_types : array

Tar file types.

Type

array

$_tmp

$_tmp : resource

Temporary contents for compressing files.

Type

resource

Methods

__construct()

__construct(array  $options = array()) 

Constructor.

Parameters

array $options

Additional options for the compressor backend.

compress()

compress(array  $data, array  $params = array()) : mixed

Compresses the data.

Parameters

array $data

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.
array $params

The parameter array.

  • stream: (boolean) If set, return a stream instead of a string. DEFAULT: Return string

Returns

mixed —

The TAR file as either a string or a stream resource.

compressDirectory()

compressDirectory(string  $directory, array  $params = array()) : mixed

Compresses a directory.

Parameters

string $directory

The directory to recursively compress.

array $params

An array of arguments needed to compress the data.

Throws

\Horde_Compress_Exception

Returns

mixed —

The compressed data.

decompress()

decompress(mixed  $data, array  $params = array()) : array

Decompresses the data.

Parameters

mixed $data

The data to decompress.

array $params

An array of arguments needed to decompress the data.

Throws

\Horde_Compress_Exception

Returns

array —

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

_getLink()

_getLink(\SplFileInfo  $spl) : string

Returns the relative path of a symbolic link

Parameters

\SplFileInfo $spl

An SplFileInfo object.

Returns

string —

The relative path of the symbolic link.

_formatNumber()

_formatNumber(array  $file, string  $method) : string

Formats a number from the file information for the TAR format.

Parameters

array $file

A file hash from compress() that may include a 'spl' entry with an .

string $method

The method of the SplFileInfo object that returns the requested number.

Returns

string —

The correctly formatted number.