Archive_Tar::listContent()
Synopsis
array listContent (
)
Описание
Lists the files and the directories of the archive.
Return value
array
-
each array entry represents a file or folder.
The array is not sorted, so the index shows the position
of the file or directory in the archive.
Each entry contains the following information:
-
$file['filename']
- Name and path of the file/dir. -
$file['mode']
- File permissions (result of fileperms()) -
$file['uid']
- user id -
$file['gid']
- group id -
$file['size']
- filesize -
$file['mtime']
- Last modification time (result of filemtime()) -
$file['typeflag']
- empty for file, "5" for directory
Throws
Error code | Error message | Reason | Solution |
---|---|---|---|
NULL |
"
Unable to open in read mode archive
"
|
The file is exclusively locked by another application. | Check for other applications working on the file. This can not be caused by a competive processing the archive with Archive_Tar |
NULL |
"
Invalid listcontent mode mode
"
|
Implementation error | Should not occur, please set up a bug report. |
NULL |
"
Directory name already exists as a file
"
|
A file is marked up as directory in the archive. | Maybe a corrupted archive. |
NULL |
"
File name already exists as a directory
"
|
A directoy is marked up as file in the archive. | Maybe a corrupted archive. |
NULL |
"
File name already exists and
is write protected.
"
|
The archive contains a file which already exists in the destination dir and can not be overwritten. | Extract the archive to an empty directory. |
NULL |
"
Unable to create path for name
"
|
One or more new nested directories could not be created in the destination directory. | Ensure the destination directory and all nested directories have the required rights. |
NULL |
"
Unable to create directory name
"
|
A directory could not be created in the destination directory. | Ensure the destination directory has the required rights. |
NULL |
"
Error while opening name in write binary mode
"
|
The file could not be created. | The file is maybe locked. |
NULL |
"
Extracted file filename does
not have the correct file size filesize
(size expected). Archive may be corrupted.
"
|
Read the message. | Read the message. |
Замечание
This function can not be called statically.
Пример
List archive content
<?php
$tar_object = new Archive_Tar("tarname.tar");
if (($v_list = $tar_object->listContent()) != 0) {
for ($i=0; $i<sizeof($v_list); $i++) {
echo "Filename :'".$v_list[$i]['filename']."'<br>";
echo " .size :'".$v_list[$i]['size']."'<br>";
echo " .mtime :'".$v_list[$i]['mtime']."' (".
date("l dS of F Y h:i:s A", $v_list[$i]['mtime']).")<br>";
echo " .mode :'".$v_list[$i]['mode']."'<br>";
echo " .uid :'".$v_list[$i]['uid']."'<br>";
echo " .gid :'".$v_list[$i]['gid']."'<br>";
echo " .typeflag :'".$v_list[$i]['typeflag']."'<br>";
}
}
?>