Class: Archive_Zip
Source Location: /lib/Zip.php
Class for manipulating zip archive files
Author(s):
Version:
|
|
|
Class Details
Class Variables
Class Methods
constructor __construct [line 127]
Archive_Zip __construct(
string
$p_zipname)
|
|
Archive_Zip Class constructor. This flavour of the constructor only declare a new Archive_Zip object, identifying it by the name of the zip file.
Tags:
Parameters:
method add [line 235]
mixed add(
mixed
$p_filelist, [mixed
$p_params = 0])
|
|
This method add files or directory in an existing Zip Archive. If the Zip Archive does not exist it is created. The files and directories to add are indicated in $p_filelist. When a directory is in the list, the directory and its content is added in the archive. The methods takes a variable list of parameters in $p_params. The supported parameters for this method are : 'add_path' : Add a path to the archived files. 'remove_path' : Remove the specified 'root' path of the archived files. 'remove_all_path' : Remove all the path of the archived files. 'no_compression' : The archived files will not be compressed. 'callback_pre_add' : A callback function that will be called before each entry archiving. 'callback_post_add' : A callback function that will be called after each entry archiving.
Tags:
Parameters:
method create [line 164]
mixed create(
mixed
$p_filelist, [mixed
$p_params = 0])
|
|
This method creates a Zip Archive with the filename set with the constructor. The files and directories indicated in $p_filelist are added in the archive. When a directory is in the list, the directory and its content is added in the archive. The methods takes a variable list of parameters in $p_params. The supported parameters for this method are : 'add_path' : Add a path to the archived files. 'remove_path' : Remove the specified 'root' path of the archived files. 'remove_all_path' : Remove all the path of the archived files. 'no_compression' : The archived files will not be compressed.
Tags:
Parameters:
method delete [line 449]
mixed delete(
mixed
$p_params)
|
|
This methods delete archive entries in the zip archive. Notice that at least one filtering rule (set by the variable parameter list) must be set. Also notice that if you delete a folder entry, only the folder entry is deleted, not all the files bellonging to this folder. The supported variable parameters for this method are : 'by_name' : It can be a string with file/dir names separated by ',', or an array of file/dir names to delete from the archive. 'by_index' : A string with range of indexes separated by ',', (sample "1,3-5,12"). 'by_ereg' : A regular expression (ereg) that must match the extracted filename. 'by_preg' : A regular expression (preg) that must match the extracted filename.
Tags:
Parameters:
method duplicate [line 556]
integer duplicate(
mixed
$p_archive)
|
|
This method creates an archive by copying the content of an other one. If the archive already exist, it is replaced by the new one without any warning.
Tags:
Parameters:
method errorCode [line 646]
Method that gives the lastest error code.
Tags:
method errorInfo [line 702]
string errorInfo(
[boolean
$p_full = false])
|
|
This method returns the description associated with the latest error.
Tags:
Parameters:
method errorName [line 660]
string errorName(
[boolean
$p_with_code = false])
|
|
This method gives the latest error code name.
Tags:
Parameters:
method extract [line 386]
mixed extract(
[mixed
$p_params = 0])
|
|
This method extract the files and folders which are in the zip archive. It can extract all the archive or a part of the archive by using filter feature (extract by name, by index, by ereg, by preg). The extraction can occur in the current path or an other path. All the advanced features are activated by the use of variable parameters. The return value is an array of entry descriptions which gives information on extracted files (See listContent()). The method may return a success value (an array) even if some files are not correctly extracted (see the file status in listContent()). The supported variable parameters for this method are : 'add_path' : Path where the files and directories are to be extracted 'remove_path' : First part ('root' part) of the memorized path (if similar) to remove while extracting. 'remove_all_path' : Remove all the memorized path while extracting. 'extract_as_string' : 'set_chmod' : After the extraction of the file the indicated mode will be set. 'by_name' : It can be a string with file/dir names separated by ',', or an array of file/dir names to extract from the archive. 'by_index' : A string with range of indexes separated by ',', (sample "1,3-5,12"). 'by_ereg' : A regular expression (ereg) that must match the extracted filename. 'by_preg' : A regular expression (preg) that must match the extracted filename. 'callback_pre_extract' : A callback function that will be called before each entry extraction. 'callback_post_extract' : A callback function that will be called after each entry extraction.
Tags:
Parameters:
method listContent [line 329]
This method gives the names and properties of the files and directories which are present in the zip archive. The properties of each entries in the list are : filename : Name of the file. For create() or add() it's the filename given by the user. For an extract() it's the filename of the extracted file. stored_filename : Name of the file / directory stored in the archive. size : Size of the stored file. compressed_size : Size of the file's data compressed in the archive (without the zip headers overhead) mtime : Last known modification date of the file (UNIX timestamp) comment : Comment associated with the file folder : true | false (indicates if the entry is a folder) index : index of the file in the archive (-1 when not available) status : status of the action on the entry (depending of the action) : Values are : ok : OK ! filtered : the file/dir was not extracted (filtered by user) already_a_directory : the file can't be extracted because a directory with the same name already exists write_protected : the file can't be extracted because a file with the same name already exists and is write protected newer_exist : the file was not extracted because a newer file already exists path_creation_fail : the file is not extracted because the folder does not exists and can't be created write_error : the file was not extracted because there was a error while writing the file read_error : the file was not extracted because there was a error while reading the file invalid_header : the file was not extracted because of an archive format error (bad file header) Note that each time a method can continue operating when there is an error on a single file, the error is only logged in the file status.
Tags:
method merge [line 603]
integer merge(
mixed
$p_archive_to_add)
|
|
This method merge a valid zip archive at the end of the archive identified by the Archive_Zip object. If the archive ($this) does not exist, the merge becomes a duplicate. If the archive to add does not exist, the merge is a success.
Tags:
Parameters:
method properties [line 501]
mixed properties(
mixed
$p_params)
|
|
This method gives the global properties of the archive. The properties are : nb : Number of files in the archive comment : Comment associated with the archive file status : not_exist, ok
Tags:
Parameters:
method _add [line 829]
void _add(
$p_list,
&$p_result_list,
&$p_params)
|
|
Archive_Zip::_add() { Description }
Parameters:
method _addFile [line 1248]
void _addFile(
$p_filename,
&$p_header,
$p_add_dir,
$p_remove_dir,
$p_remove_all_dir,
&$p_params)
|
|
Archive_Zip::_addFile() { Description }
Parameters:
method _addFileList [line 1137]
void _addFileList(
$p_list,
&$p_result_list,
$p_add_dir,
$p_remove_dir,
$p_remove_all_dir,
&$p_params)
|
|
Archive_Zip::_addFileList() { Description }
Parameters:
method _addList [line 1065]
void _addList(
$p_list,
&$p_result_list,
$p_add_dir,
$p_remove_dir,
$p_remove_all_dir,
&$p_params)
|
|
Archive_Zip::_addList() { Description }
Parameters:
method _checkFormat [line 741]
void _checkFormat(
[integer
$p_level = 0])
|
|
Archive_Zip::_checkFormat() { Description }
Parameters:
method _check_parameters [line 3224]
void _check_parameters(
&$p_params,
$p_default, integer
$p_error_code, string
$p_error_string)
|
|
Archive_Zip::_check_parameters() { Description }
Parameters:
method _closeFd [line 1033]
Archive_Zip::_closeFd() { Description }
method _convertHeader2FileInfo [line 1702]
void _convertHeader2FileInfo(
$p_header,
&$p_info)
|
|
Archive_Zip::_convertHeader2FileInfo() { Description }
Parameters:
method _create [line 790]
void _create(
$p_list,
&$p_result_list,
&$p_params)
|
|
Archive_Zip::_create() { Description }
Parameters:
method _deleteByRule [line 2642]
void _deleteByRule(
&$p_result_list,
&$p_params)
|
|
Archive_Zip::_deleteByRule() { Description }
Parameters:
method _dirCheck [line 2935]
void _dirCheck(
$p_dir, [[type]
$p_is_dir = false])
|
|
Archive_Zip::_dirCheck() { Description }
Parameters:
method _duplicate [line 3165]
void _duplicate(
$p_archive_filename)
|
|
Archive_Zip::_duplicate() { Description }
Parameters:
method _errorLog [line 3284]
void _errorLog(
[integer
$p_error_code = 0], [string
$p_error_string = ''])
|
|
Archive_Zip::_errorLog() { Description }
Parameters:
method _errorReset [line 3302]
Archive_Zip::_errorReset() { Description }
method _extractByRule [line 1744]
void _extractByRule(
&$p_file_list,
&$p_params)
|
|
Archive_Zip::_extractByRule() { Description }
Parameters:
method _extractFile [line 1979]
void _extractFile(
&$p_entry,
$p_path,
$p_remove_path,
$p_remove_all_path,
&$p_params)
|
|
Archive_Zip::_extractFile() { Description }
Parameters:
method _extractFileAsString [line 2230]
void _extractFileAsString(
&$p_entry,
&$p_string)
|
|
Archive_Zip::_extractFileAsString() { Description }
Parameters:
method _list [line 1623]
Archive_Zip::_list() { Description }
Parameters:
method _merge [line 2987]
void _merge(
&$p_archive_to_add)
|
|
Archive_Zip::_merge() { Description }
Parameters:
method _openFd [line 996]
Archive_Zip::_openFd() { Description }
Parameters:
method _readCentralFileHeader [line 2402]
void _readCentralFileHeader(
&$p_header)
|
|
Archive_Zip::_readCentralFileHeader() { Description }
Parameters:
method _readEndCentralDir [line 2512]
void _readEndCentralDir(
&$p_central_dir)
|
|
Archive_Zip::_readEndCentralDir() { Description }
Parameters:
method _readFileHeader [line 2293]
void _readFileHeader(
&$p_header)
|
|
Archive_Zip::_readFileHeader() { Description }
Parameters:
method _tool_CopyBlock [line 3459]
void _tool_CopyBlock(
$p_src,
$p_dest,
$p_size, [integer
$p_mode = 0])
|
|
_tool_CopyBlock() { Description }
Parameters:
method _tool_PathInclusion [line 3383]
void _tool_PathInclusion(
$p_dir,
$p_path)
|
|
_tool_PathInclusion() { Description }
Parameters:
method _tool_PathReduction [line 3321]
void _tool_PathReduction(
$p_dir)
|
|
_tool_PathReduction() { Description }
Parameters:
method _tool_Rename [line 3531]
void _tool_Rename(
$p_src,
$p_dest)
|
|
_tool_Rename() { Description }
Parameters:
method _tool_TranslateWinPath [line 3570]
void _tool_TranslateWinPath(
$p_path, [[type]
$p_remove_disk_letter = true])
|
|
_tool_TranslateWinPath() { Description }
Parameters:
method _writeCentralFileHeader [line 1536]
void _writeCentralFileHeader(
&$p_header)
|
|
Archive_Zip::_writeCentralFileHeader() { Description }
Parameters:
method _writeCentralHeader [line 1590]
void _writeCentralHeader(
$p_nb_entries,
$p_size,
$p_offset,
$p_comment)
|
|
Archive_Zip::_writeCentralHeader() { Description }
Parameters:
method _writeFileHeader [line 1484]
void _writeFileHeader(
&$p_header)
|
|
Archive_Zip::_writeFileHeader() { Description }
Parameters:
|
|