PrivilegedFile
extends File
in package
Privileged File
A file object that is allowed to access all files of a Cloudrexx installation.
Tags
Table of Contents
Constants
- PHP_ACCESS = 1
- UNKNOWN_ACCESS = 0
Properties
- $file : string
- The value of $file that has been passed to the constructor.
- $fsFile : FileSystemFile
Methods
- __construct() : mixed
- Instanciate a file system file to perform operations on.
- __toString() : string
- Returns the path to this file
- append() : mixed
- copy() : mixed
- delete() : true
- Removes file
- exists() : bool
- Wrapper for file_exists()
- getAbsoluteFilePath() : string
- Get absolute path of file
- getAccessMode() : mixed
- getData() : mixed
- getHandle() : resource
- Returns a file handle for the given file
- getRelativeFilePath() : string
- Get relative path of file
- isWithinWebsiteData() : bool
- Returns whether this file is part of website data
- makeWritable() : true
- Sets write access to file's owner
- move() : mixed
- rename() : mixed
- touch() : true
- Creates files if it doesn't exists yet
- write() : true
- Write data specified by $data to file
- getFileInstance() : FileSystemFile
Constants
PHP_ACCESS
public
mixed
PHP_ACCESS
= 1
UNKNOWN_ACCESS
public
mixed
UNKNOWN_ACCESS
= 0
Properties
$file
The value of $file that has been passed to the constructor.
protected
string
$file
= null
$fsFile
protected
FileSystemFile
$fsFile
= null
Local FileSystemFile instance of the instanciated filesystem file. In case access mode is PHP_ACCESS or UNKNOWN_ACCESS then all file operations will be performed directly on this instance.
Methods
__construct()
Instanciate a file system file to perform operations on.
public
__construct(string $file) : mixed
By default only the instantiation of files located in one of the following locations is allowed:
- /images
- /media
- /themes
- /tmp/session-
Parameters
- $file : string
-
Path to file
Tags
__toString()
Returns the path to this file
public
__toString() : string
Tags
Return values
string —Path to this file
append()
public
append(mixed $data) : mixed
Parameters
- $data : mixed
copy()
public
copy(mixed $dst[, mixed $force = false ]) : mixed
Parameters
- $dst : mixed
- $force : mixed = false
delete()
Removes file
public
delete() : true
Tags
Return values
true —if file has successfully been removed
exists()
Wrapper for file_exists()
public
exists() : bool
Tags
Return values
bool —True if the file exists
getAbsoluteFilePath()
Get absolute path of file
public
getAbsoluteFilePath() : string
Return values
string —Absolute path of file
getAccessMode()
public
getAccessMode() : mixed
getData()
public
getData() : mixed
getHandle()
Returns a file handle for the given file
public
getHandle([bool $writable = false ]) : resource
Parameters
- $writable : bool = false
-
Set to true if you need to write to the handle
Tags
Return values
resource —A file handle
getRelativeFilePath()
Get relative path of file
public
getRelativeFilePath() : string
Return values
string —Relative path of file
isWithinWebsiteData()
Returns whether this file is part of website data
public
isWithinWebsiteData() : bool
Tags
Return values
bool —True if this is a website data file
makeWritable()
Sets write access to file's owner
public
makeWritable() : true
Tags
Return values
true —if file is already writable or setting write access was successful
move()
public
move(mixed $dst[, mixed $force = false ]) : mixed
Parameters
- $dst : mixed
- $force : mixed = false
rename()
public
rename(mixed $dst[, mixed $force = false ]) : mixed
Parameters
- $dst : mixed
- $force : mixed = false
touch()
Creates files if it doesn't exists yet
public
touch() : true
Tags
Return values
true —on success
write()
Write data specified by $data to file
public
write(mixed $data) : true
Parameters
- $data : mixed
Tags
Return values
true —on sucess
getFileInstance()
protected
getFileInstance() : FileSystemFile