eZ Publish  [4.2]
eZTARArchiveHandler Class Reference
+ Inheritance diagram for eZTARArchiveHandler:
+ Collaboration diagram for eZTARArchiveHandler:

List of all members.

Public Member Functions

 _addFile ($p_filename, &$p_header, $p_add_dir, $p_remove_dir)
 _addList ($p_list, $p_add_dir, $p_remove_dir)
 _addString ($p_filename, $p_string)
 _append ($p_filelist, $p_add_dir='', $p_remove_dir='')
 _cleanFile ()
 _close ()
 _dirCheck ($p_dir)
 Check if a directory exists and create it (including parent dirs) if not.
 _error ($p_message)
 _extractInString ($p_filename)
 This method extract from the archive one file identified by $p_filename.
 _extractList ($p_path, &$p_list_detail, $p_mode, $p_file_list, $p_remove_path)
 _eZTARArchiveHandler ()
 _jumpBlock ($p_len=null)
 _openAppend ()
 _openRead ()
 _openReadWrite ()
 _openWrite ()
 _pathReduction ($p_dir)
 Compress path by changing for example "/dir/foo/../bar" to "/dir/bar", and remove double slashes.
 _readBlock ($p_len=null)
 _readHeader ($v_binary_data, &$v_header)
 _readLongHeader (&$v_header)
 _translateWinPath ($p_path, $p_remove_disk_letter=true)
 _warning ($p_message)
 _writeBlock ($p_binary_data, $p_len=null)
 _writeFooter ()
 _writeHeader ($p_filename, $p_stored_filename)
 _writeHeaderBlock ($p_filename, $p_size, $p_mtime=0, $p_perms=0, $p_type='', $p_uid=0, $p_gid=0)
 _writeLongHeader ($p_filename)
 add ($p_filelist)
 This method add the files / directories that are listed in $p_filelist in the archive.
 addModify ($p_filelist, $p_add_dir, $p_remove_dir='')
 This method add the files / directories listed in $p_filelist at the end of the existing archive.
 addString ($p_filename, $p_string)
 This method add a single string as a file at the end of the existing archive.
 create ($p_filelist)
 This method creates the archive file and add the files / directories that are listed in $p_filelist.
 createModify ($p_filelist, $p_add_dir, $p_remove_dir='')
 This method creates the archive file and add the files / directories that are listed in $p_filelist.
 extract ($p_path='')
 extractInString ($p_filename)
 This method extract from the archive one file identified by $p_filename.
 extractList ($p_filelist, $p_path='', $p_remove_path='')
 This method extract from the archive only the files indicated in the $p_filelist.
 extractModify ($p_path, $p_remove_path)
 This method extract all the content of the archive in the directory indicated by $p_path.
 eZTARArchiveHandler (&$fileHandler, $p_tarname, $p_compress=false)
 Archive_Tar Class constructor.
 listContent ()

Public Attributes

 $_compress = false
 $_compress_type = 'none'
 $_tarname = ''
 $_temp_tarname = ''

Detailed Description

Definition at line 29 of file eztararchivehandler.php.


Member Function Documentation

eZTARArchiveHandler::_addFile ( p_filename,
&$  p_header,
p_add_dir,
p_remove_dir 
)

Definition at line 680 of file eztararchivehandler.php.

Referenced by _addList().

eZTARArchiveHandler::_addList ( p_list,
p_add_dir,
p_remove_dir 
)

Definition at line 831 of file eztararchivehandler.php.

Referenced by _append(), and createModify().

eZTARArchiveHandler::_addString ( p_filename,
p_string 
)

Definition at line 775 of file eztararchivehandler.php.

Referenced by addString().

eZTARArchiveHandler::_append ( p_filelist,
p_add_dir = '',
p_remove_dir = '' 
)

Definition at line 1568 of file eztararchivehandler.php.

Referenced by addModify().

eZTARArchiveHandler::_cleanFile ( )

Definition at line 583 of file eztararchivehandler.php.

Referenced by createModify().

eZTARArchiveHandler::_dirCheck ( p_dir)

Check if a directory exists and create it (including parent dirs) if not.

Parameters:
string$p_dirdirectory to check
Returns:
bool TRUE if the directory exists or was created

Definition at line 1592 of file eztararchivehandler.php.

Referenced by _extractList().

eZTARArchiveHandler::_extractInString ( p_filename)

This method extract from the archive one file identified by $p_filename.

The return value is a string with the file content, or NULL on error.

Parameters:
string$p_filenameThe path of the file to extract in a string.
Returns:
a string with the file content or NULL. private

Definition at line 1223 of file eztararchivehandler.php.

Referenced by extractInString().

eZTARArchiveHandler::_extractList ( p_path,
&$  p_list_detail,
p_mode,
p_file_list,
p_remove_path 
)

Definition at line 1266 of file eztararchivehandler.php.

Referenced by extractList(), extractModify(), and listContent().

eZTARArchiveHandler::_eZTARArchiveHandler ( )

Definition at line 95 of file eztararchivehandler.php.

eZTARArchiveHandler::_jumpBlock ( p_len = null)

Definition at line 657 of file eztararchivehandler.php.

Referenced by _extractInString().

eZTARArchiveHandler::_openAppend ( )

Definition at line 1489 of file eztararchivehandler.php.

Referenced by _append(), and addString().

eZTARArchiveHandler::_openRead ( )

Definition at line 486 of file eztararchivehandler.php.

Referenced by extractInString(), extractList(), extractModify(), and listContent().

eZTARArchiveHandler::_openReadWrite ( )

Definition at line 538 of file eztararchivehandler.php.

eZTARArchiveHandler::_openWrite ( )

Definition at line 467 of file eztararchivehandler.php.

Referenced by addString(), and createModify().

eZTARArchiveHandler::_pathReduction ( p_dir)

Compress path by changing for example "/dir/foo/../bar" to "/dir/bar", and remove double slashes.

Parameters:
string$p_dirpath to reduce
Returns:
string reduced path

private

Definition at line 1627 of file eztararchivehandler.php.

Referenced by _addFile(), _writeHeader(), and _writeHeaderBlock().

eZTARArchiveHandler::_readBlock ( p_len = null)

Definition at line 635 of file eztararchivehandler.php.

Referenced by _extractInString(), _jumpBlock(), and _readLongHeader().

eZTARArchiveHandler::_readHeader ( v_binary_data,
&$  v_header 
)

Definition at line 1125 of file eztararchivehandler.php.

Referenced by _extractInString(), _extractList(), and _readLongHeader().

eZTARArchiveHandler::_readLongHeader ( &$  v_header)

Definition at line 1190 of file eztararchivehandler.php.

Referenced by _extractInString(), and _extractList().

eZTARArchiveHandler::_translateWinPath ( p_path,
p_remove_disk_letter = true 
)

Definition at line 1662 of file eztararchivehandler.php.

Referenced by _addFile(), _addString(), and _extractList().

eZTARArchiveHandler::_warning ( p_message)

Definition at line 458 of file eztararchivehandler.php.

Referenced by _addFile(), and _addList().

eZTARArchiveHandler::_writeBlock ( p_binary_data,
p_len = null 
)

Definition at line 606 of file eztararchivehandler.php.

Referenced by _addString(), _writeHeaderBlock(), and _writeLongHeader().

eZTARArchiveHandler::_writeFooter ( )

Definition at line 804 of file eztararchivehandler.php.

Referenced by _append(), addString(), and createModify().

eZTARArchiveHandler::_writeHeader ( p_filename,
p_stored_filename 
)

Definition at line 907 of file eztararchivehandler.php.

Referenced by _addFile().

eZTARArchiveHandler::_writeHeaderBlock ( p_filename,
p_size,
p_mtime = 0,
p_perms = 0,
p_type = '',
p_uid = 0,
p_gid = 0 
)

Definition at line 997 of file eztararchivehandler.php.

Referenced by _addString().

eZTARArchiveHandler::_writeLongHeader ( p_filename)

Definition at line 1065 of file eztararchivehandler.php.

Referenced by _writeHeader(), and _writeHeaderBlock().

eZTARArchiveHandler::add ( p_filelist)

This method add the files / directories that are listed in $p_filelist in the archive.

If the archive does not exist it is created. The method return false and a PEAR error text. The files and directories listed are only added at the end of the archive, even if a file with the same name is already archived. See also createModify() method for more details.

Parameters:
array$p_filelistAn array of filenames and directory names, or a single string with names separated by a single blank space.
Returns:
true on success, false on error.
See also:
createModify() public

Definition at line 147 of file eztararchivehandler.php.

eZTARArchiveHandler::addModify ( p_filelist,
p_add_dir,
p_remove_dir = '' 
)

This method add the files / directories listed in $p_filelist at the end of the existing archive.

If the archive does not yet exists it is created. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. The path indicated in $p_remove_dir will be removed from the memorized path of each file / directory listed when this path exists. By default nothing is removed (empty path '') The path indicated in $p_add_dir will be added at the beginning of the memorized path of each file / directory listed. However it can be set to empty ''. The adding of a path is done after the removing of path. The path add/remove ability enables the user to prepare an archive for extraction in a different path than the origin files are. If a file/dir is already in the archive it will only be added at the end of the archive. There is no update of the existing archived file/dir. However while extracting the archive, the last file will replace the first one. This results in a none optimization of the archive size. If a file/dir does not exist the file/dir is ignored. However an error text is send to PEAR error. If a file/dir is not readable the file/dir is ignored. However an error text is send to PEAR error.

Parameters:
array$p_filelistAn array of filenames and directory names, or a single string with names separated by a single blank space.
string$p_add_dirA string which contains a path to be added to the memorized path of each element in the list.
string$p_remove_dirA string which contains a path to be removed from the memorized path of each element in the list, when relevant.
Returns:
true on success, false on error. public

Definition at line 280 of file eztararchivehandler.php.

Referenced by add().

eZTARArchiveHandler::addString ( p_filename,
p_string 
)

This method add a single string as a file at the end of the existing archive.

If the archive does not yet exists it is created.

Parameters:
string$p_filenameA string which contains the full filename path that will be associated with the string.
string$p_stringThe content of the file added in the archive.
Returns:
true on success, false on error. public

Definition at line 315 of file eztararchivehandler.php.

eZTARArchiveHandler::create ( p_filelist)

This method creates the archive file and add the files / directories that are listed in $p_filelist.

If a file with the same name exist and is writable, it is replaced by the new tar. The method return false and a PEAR error text. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. For each directory added in the archive, the files and sub-directories are also added. See also createModify() method for more details.

Parameters:
array$p_filelistAn array of filenames and directory names, or a single string with names separated by a single blank space.
Returns:
true on success, false on error.
See also:
createModify() public

Definition at line 126 of file eztararchivehandler.php.

eZTARArchiveHandler::createModify ( p_filelist,
p_add_dir,
p_remove_dir = '' 
)

This method creates the archive file and add the files / directories that are listed in $p_filelist.

If the file already exists and is writable, it is replaced by the new tar. It is a create and not an add. If the file exists and is read-only or is a directory it is not replaced. The method return false and a PEAR error text. The $p_filelist parameter can be an array of string, each string representing a filename or a directory name with their path if needed. It can also be a single string with names separated by a single blank. The path indicated in $p_remove_dir will be removed from the memorized path of each file / directory listed when this path exists. By default nothing is removed (empty path '') The path indicated in $p_add_dir will be added at the beginning of the memorized path of each file / directory listed. However it can be set to empty ''. The adding of a path is done after the removing of path. The path add/remove ability enables the user to prepare an archive for extraction in a different path than the origin files are. See also addModify() method for file adding properties.

Parameters:
array$p_filelistAn array of filenames and directory names, or a single string with names separated by a single blank space.
string$p_add_dirA string which contains a path to be added to the memorized path of each element in the list.
string$p_remove_dirA string which contains a path to be removed from the memorized path of each element in the list, when relevant.
Returns:
boolean true on success, false on error. public
See also:
addModify()

Definition at line 211 of file eztararchivehandler.php.

Referenced by addModify(), and create().

eZTARArchiveHandler::extract ( p_path = '')

Definition at line 154 of file eztararchivehandler.php.

eZTARArchiveHandler::extractInString ( p_filename)

This method extract from the archive one file identified by $p_filename.

The return value is a string with the file content, or NULL on error.

Parameters:
string$p_filenameThe path of the file to extract in a string.
Returns:
a string with the file content or NULL. public

Definition at line 395 of file eztararchivehandler.php.

eZTARArchiveHandler::extractList ( p_filelist,
p_path = '',
p_remove_path = '' 
)

This method extract from the archive only the files indicated in the $p_filelist.

These files are extracted in the current directory or in the directory indicated by the optional $p_path parameter. If indicated the $p_remove_path can be used in the same way as it is used in extractModify() method.

Parameters:
array$p_filelistAn array of filenames and directory names, or a single string with names separated by a single blank space.
string$p_pathThe path of the directory where the files/dir need to by extracted.
string$p_remove_pathPart of the memorized path that can be removed if present at the beginning of the file/dir path.
Returns:
true on success, false on error. public
See also:
extractModify()

Definition at line 425 of file eztararchivehandler.php.

eZTARArchiveHandler::extractModify ( p_path,
p_remove_path 
)

This method extract all the content of the archive in the directory indicated by $p_path.

When relevant the memorized path of the files/dir can be modified by removing the $p_remove_path path at the beginning of the file/dir path. While extracting a file, if the directory path does not exist it is created. While extracting a file, if the file already exists it is replaced without looking for last modification date. While extracting a file, if the file already exists and is write protected, the extraction is aborted. While extracting a file, if a directory with the same name already exists, the extraction is aborted. While extracting a directory, if a file with the same name already exists, the extraction is aborted. While extracting a file/directory if the destination directory exist and is write protected, or does not exist but can not be created, the extraction is aborted. If after extraction an extracted file does not show the correct stored file size, the extraction is aborted. When the extraction is aborted, a PEAR error text is set and false is returned. However the result can be a partial extraction that may need to be manually cleaned.

Parameters:
string$p_pathThe path of the directory where the files/dir need to by extracted.
string$p_remove_pathPart of the memorized path that can be removed if present at the beginning of the file/dir path.
Returns:
boolean true on success, false on error. public
See also:
extractList()

Definition at line 373 of file eztararchivehandler.php.

Referenced by extract().

eZTARArchiveHandler::eZTARArchiveHandler ( &$  fileHandler,
p_tarname,
p_compress = false 
)

Archive_Tar Class constructor.

This flavour of the constructor only declare a new Archive_Tar object, identifying it by the name of the tar file. If the compress argument is set the tar will be read or created as a gzip or bz2 compressed TAR file.

Parameters:
string$p_tarnameThe name of the tar archive to create
string$p_compresscan be null, 'gz' or 'bz2'. This parameter indicates if gzip or bz2 compression is required. For compatibility reason the boolean value 'true' means 'gz'. public

Definition at line 70 of file eztararchivehandler.php.

eZTARArchiveHandler::listContent ( )

Definition at line 161 of file eztararchivehandler.php.


Member Data Documentation

eZTARArchiveHandler::$_compress = false

Definition at line 39 of file eztararchivehandler.php.

eZTARArchiveHandler::$_compress_type = 'none'

Definition at line 48 of file eztararchivehandler.php.

eZTARArchiveHandler::$_tarname = ''

Definition at line 34 of file eztararchivehandler.php.

eZTARArchiveHandler::$_temp_tarname = ''

Definition at line 53 of file eztararchivehandler.php.


The documentation for this class was generated from the following file: