Methods summary
public
|
#
Archive_Zip( 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.
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.
Parameters
- $p_zipname
string The name of the zip archive to create
|
public
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.
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.
Parameters
- $p_filelist
mixed The list of the files or folders to add. It can be a string with filenames
separated by a comma, or an array of filenames.
- $p_params
mixed An array of variable parameters and values.
Returns
mixed An array of file description on success, an error code on error
|
public
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.
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.
Parameters
- $p_filelist
mixed The list of the files or folders to add. It can be a string with filenames
separated by a comma, or an array of filenames.
- $p_params
mixed An array of variable parameters and values.
Returns
mixed An array of file description on success, 0 on an unrecoverable failure, an error
code is logged.
|
public
mixed
|
#
listContent( )
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.
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.
Returns
mixed An array of file description on success, 0 on an unrecoverable failure, an error
code is logged.
|
public
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.
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.
Parameters
- $p_params
mixed An array of variable parameters and values.
Returns
mixed An array of file description on success, 0 on an unrecoverable failure, an error
code is logged.
|
public
mixed
|
#
properties( )
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
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
Returns
mixed An array with the global properties or 0 on error.
|
public
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.
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.
Parameters
- $p_archive
mixed It can be a valid Archive_Zip object or the filename of a valid zip archive.
Returns
integer 1 on success, 0 on failure.
|
public
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.
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.
Parameters
- $p_archive_to_add
mixed It can be a valid Archive_Zip object or the filename of a valid zip archive.
Returns
integer 1 on success, 0 on failure.
|
public
integer
|
#
errorCode( )
Method that gives the lastest error code.
Method that gives the lastest error code.
Returns
integer The error code value.
|
public
string
|
#
errorName( boolean $p_with_code = false )
This method gives the latest error code name.
This method gives the latest error code name.
Parameters
- $p_with_code
boolean If true, gives the name and the int value.
Returns
string The error name.
|
public
string
|
#
errorInfo( boolean $p_full = false )
This method returns the description associated with the latest error.
This method returns the description associated with the latest error.
Parameters
- $p_full
boolean If set to true gives the description with the error code, the name and the
description. If set to false gives only the description and the error code.
Returns
string The error description.
|
public
|
#
_checkFormat( integer $p_level = 0 )
Archive_Zip::_checkFormat()
Archive_Zip::_checkFormat()
{ Description }
Parameters
|
public
|
#
_create( $p_list, & $p_result_list, & $p_params )
Archive_Zip::_create()
{ Description }
|
public
|
#
_add( $p_list, & $p_result_list, & $p_params )
Archive_Zip::_add()
{ Description }
|
public
|
#
_openFd( $p_mode )
Archive_Zip::_openFd()
{ Description }
|
public
|
#
_closeFd( )
Archive_Zip::_closeFd()
{ Description }
|
public
|
#
_addList( $p_list, & $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, & $p_params )
Archive_Zip::_addList()
{ Description }
|
public
|
#
_addFileList( $p_list, & $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, & $p_params )
Archive_Zip::_addFileList()
Archive_Zip::_addFileList()
{ Description }
|
public
|
#
_addFile( $p_filename, & $p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, & $p_params )
Archive_Zip::_addFile()
{ Description }
|
public
|
#
_list( & $p_list )
Archive_Zip::_list()
{ Description }
|
public
|
#
_readEndCentralDir( & $p_central_dir )
Archive_Zip::_readEndCentralDir()
Archive_Zip::_readEndCentralDir()
{ Description }
|
public
|
#
_deleteByRule( & $p_result_list, & $p_params )
Archive_Zip::_deleteByRule()
Archive_Zip::_deleteByRule()
{ Description }
|
public
|
#
_dirCheck( [type] $p_dir, $p_is_dir = false )
Archive_Zip::_dirCheck()
{ Description }
Parameters
- $p_dir
[type] $p_is_dir
- $p_is_dir
|
public
|
#
_merge( & $p_archive_to_add )
Archive_Zip::_merge()
{ Description }
|
public
|
#
_duplicate( $p_archive_filename )
Archive_Zip::_duplicate()
Archive_Zip::_duplicate()
{ Description }
|
public
|
#
_check_parameters( integer & $p_params, string $p_default )
Archive_Zip::_check_parameters()
Archive_Zip::_check_parameters()
{ Description }
Parameters
- $p_params
integer $p_error_code
- $p_default
string $p_error_string
|
public
|
#
_errorLog( integer $p_error_code = 0, string $p_error_string = '' )
Archive_Zip::_errorLog()
{ Description }
Parameters
- $p_error_code
integer
- $p_error_string
string
|
public
|
#
_errorReset( )
Archive_Zip::_errorReset()
Archive_Zip::_errorReset()
{ Description }
|
public
|
|
public
|
|
public
|
#
_tool_CopyBlock( integer $p_src, $p_dest, $p_size, $p_mode = 0 )
_tool_CopyBlock()
{ Description }
Parameters
- $p_src
integer $p_mode
- $p_dest
- $p_size
- $p_mode
|
public
|
|
public
|
#
_tool_TranslateWinPath( [type] $p_path, $p_remove_disk_letter = true )
_tool_TranslateWinPath()
{ Description }
Parameters
- $p_path
[type] $p_remove_disk_letter
- $p_remove_disk_letter
|