JPath
A Path handling class
package |
Joomla.Platform |
---|---|
subpackage |
FileSystem |
since |
11.1 |
Methods
canChmod
Checks if a path's permissions can be changed.
canChmod(string $path) : boolean
since |
11.1 |
---|
Arguments
- $path
string
Path to check.
Response
boolean
True if path can have mode changed.
check
Checks for snooping outside of the file system root.
check(string $path, string $ds = DIRECTORY_SEPARATOR) : string
since |
11.1 |
---|
Arguments
- $path
string
A file system path to check.- $ds
string
Directory separator (optional).
Response
string
A cleaned version of the path or exit on error.
clean
Function to strip additional / or \ in a path name.
clean(string $path, string $ds = DIRECTORY_SEPARATOR) : string
since |
11.1 |
---|---|
throws |
|
Arguments
- $path
string
The path to clean.- $ds
string
Directory separator (optional).
Response
string
The cleaned path.
find
Searches the directory paths for a given file.
find(mixed $paths, string $file) : mixed
since |
11.1 |
---|
Arguments
- $paths
mixed
An path string or array of path strings to search in- $file
string
The file name to look for.
Response
mixed
The full path and file name for the target file, or boolean false if the file is not found in any of the paths.
getPermissions
Get the permissions of the file/folder at a give path.
getPermissions(string $path) : string
since |
11.1 |
---|
Arguments
- $path
string
The path of a file/folder.
Response
string
Filesystem permissions.
isOwner
Method to determine if script owns the path.
isOwner(string $path) : boolean
since |
11.1 |
---|
Arguments
- $path
string
Path to check ownership.
Response
boolean
True if the php script owns the path passed.
setPermissions
Chmods files and directories recursively to given permissions.
setPermissions(string $path, string $filemode = '0644', string $foldermode = '0755') : boolean
since |
11.1 |
---|
Arguments
- $path
string
Root path to begin changing mode [without trailing slash].- $filemode
string
Octal representation of the value to change file mode to [null = no change].- $foldermode
string
Octal representation of the value to change folder mode to [null = no change].
Response
boolean
True if successful [one fail means the whole operation failed].