The ezcArchiveEntry class provides system-independent file information.
ezcArchiveEntry provides file information about the file path, it's access rights and whether the file is an directory, symbolic link, hard link, block-file, etc. The owner name, the group name, the last access time are also available. ezcArchiveEntry can be used to get the file information directly from the file-system or from an archive.
The main purpose of ezcArchiveEntry is to provide information about:
When the ezcArchiveEntry is an entry in the archive, the getPath() method contains always an relative path, and the prefix is not set.
Source for this file: /Archive/src/entry.php
Version: | //autogentag// |
IS_BLOCK_DEVICE
= 4
|
Is a block device. |
IS_CHARACTER_DEVICE
= 3
|
Is a character device. |
IS_DIRECTORY
= 5
|
Is a directory. |
IS_FIFO
= 6
|
Is a FIFO. |
IS_FILE
= 0
|
Is a regular file. |
IS_LINK
= 1
|
Is a hard link. |
IS_RESERVED
= 7
|
Not used, is Tar specific? |
IS_SYMBOLIC_LINK
= 2
|
Is a symbolic link. |
protected ezcArchiveFileStructure |
$fileStructure
Contains the file information. |
protected string |
$prefix
The prefix of the file that may be removed from the path. |
public static ezcArchiveEntry |
getEntryFromFile(
$files
, $prefix
)
Returns one or an array of ezcArchiveEntry's from one or multiple files in the file system. |
protected static ezcArchiveFileStructure |
getFileStructureFromFile(
$file
)
Create a file structure from a $file in the file system. |
protected static int |
getLinkType(
$stat
)
Returns an ezcArchiveEntry-type that corresponds to the ezcArchiveStatMode-type |
public ezcArchiveEntry |
__construct(
$struct
)
Constructs an archiveEntry from the ezcArchiveFileStructure. |
public int |
getAccessTime(
)
Returns the last access time as a timestamp. |
public int |
getDevice(
)
Returns the device. |
public int |
getGroupId(
)
Returns the group ID of the entry. |
public int |
getInode(
)
Returns the inode. |
public void |
getLink(
[ $withPrefix
= true] )
Returns the link with or without prefix. |
public int |
getMajor(
)
Returns the major device number. |
public int |
getMinor(
)
Returns the minor device number. |
public int |
getModificationTime(
)
Returns the modification time as a timestamp. |
public string |
getPath(
[ $withPrefix
= true] )
Returns the complete path or path without the prefix. |
public string |
getPermissions(
)
Returns a bit mask representing the permissions of this entry. |
public string |
getPermissionsString(
)
Returns the permissions as a string. |
public string |
getPrefix(
)
Returns the prefix. |
public int |
getSize(
)
Returns the file size. |
public int |
getType(
)
Returns type of the entry. |
public string |
getTypeString(
)
Returns the type string for the current type of the entry. |
public int |
getUserId(
)
Returns the user ID of the entry. |
public bool |
isDirectory(
)
Returns true when this entry represents a directory. |
public bool |
isFile(
)
Returns true when this entry represents a file. |
public bool |
isHardLink(
)
Returns true when this entry represents a hard link. |
public bool |
isLink(
)
Returns true when this entry represents a symbolic or a hard link. |
public bool |
isSymLink(
)
Returns true when this entry represents a symbolic link. |
public void |
removePrefixFromPath(
)
Removes the prefix from the path and clears the prefix. |
public void |
setPrefix(
$prefix
)
Sets the prefix. |
public string |
__toString(
)
Returns a string representing the current entry. |
Returns one or an array of ezcArchiveEntry's from one or multiple files in the file system.
One or multiple ezcArchiveEntry's are created upon the given files. The prefix will directly set for the ezcArchiveEntry with $prefix.
If $files contains a path to a file, then one ezcArchiveEntry will be created and returned. If $files is an array of paths, then all those ezcArchiveEntry's will be created and returned in an array.
When multiple files are given in an array, this method will search for hard links among other files in the array.
Name | Type | Description |
---|---|---|
$files |
string|array(string) | |
$prefix |
string |
Type | Description |
---|---|
ezcArchiveEntryPrefixException |
if the prefix is invalid. |
Create a file structure from a $file in the file system.
Name | Type | Description |
---|---|---|
$file |
string |
Returns an ezcArchiveEntry-type that corresponds to the ezcArchiveStatMode-type
Name | Type | Description |
---|---|---|
$stat |
ezcArchiveStatMode | Possible values are: ezcArchiveStatMode::S_IFIFO, ezcArchiveStatMode::S_IFCHR, ezcArchiveStatMode::S_IFDIR, ezcArchiveStatMode::S_IFBLK, ezcArchiveStatMode::S_IFREG, or ezcArchiveStatMode::S_IFLNK. |
Constructs an archiveEntry from the ezcArchiveFileStructure.
The $struct parameter contains the raw file information. This class encapsulates the file information structure and provides convenient methods to retrieve the information.
Name | Type | Description |
---|---|---|
$struct |
ezcArchiveFileStructure |
Returns the last access time as a timestamp.
Returns the device.
FIXME DEPRECATED?
Returns the group ID of the entry.
Returns the inode.
Returns the link with or without prefix.
This method is similar to getPath(), but returns the link instead of the path. If the current does not represents a link, an empty string is returned. Use the isLink() method to see if the current entry is a link.
Name | Type | Description |
---|---|---|
$withPrefix |
bool |
Returns the major device number.
Returns the minor device number.
Returns the modification time as a timestamp.
Returns the complete path or path without the prefix.
By default the full path is returned, unless the $withPrefix is set to true.
Name | Type | Description |
---|---|---|
$withPrefix |
bool |
Returns a bit mask representing the permissions of this entry.
It returns the permissions in octal numbers as a string, for example: "0000755"
Returns the permissions as a string.
If the entry has all the permissions, it will return: "rwxrwx" Where the first three letters represent the group permissions and the last three letters the user permissions.
Returns the prefix.
Returns the file size.
Returns type of the entry.
Returns the type string for the current type of the entry.
Returns a type string for the current entry. If the entry is a:
Returns the user ID of the entry.
Returns true when this entry represents a directory.
Returns true when this entry represents a file.
Returns true when this entry represents a hard link.
Returns true when this entry represents a symbolic or a hard link.
Returns true when this entry represents a symbolic link.
Removes the prefix from the path and clears the prefix.
This method is useful when it comes to adding a entry to an archive and the complete path to the file is no longer needed.
Sets the prefix.
Name | Type | Description |
---|---|---|
$prefix |
string |
Returns a string representing the current entry.