Documentation

PrivilegedFile extends File
in package

Privileged File

A file object that is allowed to access all files of a Cloudrexx installation.

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Thomas Wirz thomas.wirz@cloudrexx.com

subpackage

lib_filesystem

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

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
throws
FileException

In case $file is not a valid path or $file points to a location this instance is not allowed to access to.

__toString()

Returns the path to this file

public __toString() : string
Tags
inheritDoc
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
throws
FileSystemException

if removing of file fails

Return values
true

if file has successfully been removed

exists()

Wrapper for file_exists()

public exists() : bool
Tags
inheritDoc
Return values
bool

True if the file exists

getAbsoluteFilePath()

Get absolute path of file

public getAbsoluteFilePath() : string
Return values
string

Absolute path of file

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
inheritDoc
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
inheritDoc
Return values
bool

True if this is a website data file

makeWritable()

Sets write access to file's owner

public makeWritable() : true
Tags
throws
FileSystemException

if setting write access fails

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
throws
FileSystemException

if file does not exist and creating fails

Return values
true

on success

write()

Write data specified by $data to file

public write(mixed $data) : true
Parameters
$data : mixed
Tags
throws
FileSystemException

if writing to file fails

Return values
true

on sucess


        
On this page

Search results