PHP Class ElggDiskFilestore, Elgg

Inheritance: extends ElggFilestore
Mostra file Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( string $directory_root = "" ) Construct a disk filestore using the given directory root.
close ( resource $f ) : boolean Close a file pointer
delete ( ElggFile $file, boolean $follow_symlinks = true ) : boolean Delete an \ElggFile file.
eof ( resource $f ) : boolean Tests for end of file on a file pointer
exists ( ElggFile $file ) : boolean Tests if an \ElggFile file exists.
getFileSize ( ElggFile $file ) : integer Returns the file size of an \ElggFile file.
getFilenameOnFilestore ( ElggFile $file ) : string Get the filename as saved on disk for an \ElggFile object
getParameters ( ) : array Returns a list of attributes to save to the database when saving the \ElggFile object using this file store.
getSize ( string $prefix, string $container_guid ) : integer | false Returns the size of all data stored under a directory in the disk store.
grabFile ( ElggFile $file ) : string Returns the contents of the \ElggFile file.
open ( ElggFile $file, string $mode ) : resource Open a file for reading, writing, or both.
read ( resource $f, integer $length, integer $offset ) : mixed Read data from a file.
seek ( resource $f, integer $position ) : integer Seek to the specified position.
setParameters ( array $parameters ) : boolean Sets parameters that should be saved to database.
tell ( resource $f ) : integer | false Return the current location of the internal pointer
write ( resource $f, mixed $data ) : boolean Write data to a file.

Protected Methods

Method Description
makeDirectoryRoot ( string $dirroot ) : true Create a directory $dirroot

Method Details

__construct() public method

Construct a disk filestore using the given directory root.
public __construct ( string $directory_root = "" )
$directory_root string Root directory, must end in "/"

close() public method

Close a file pointer
public close ( resource $f ) : boolean
$f resource A file pointer resource
return boolean

delete() public method

Delete an \ElggFile file.
public delete ( ElggFile $file, boolean $follow_symlinks = true ) : boolean
$file ElggFile File to delete
$follow_symlinks boolean If true, will also delete the target file if the current file is a symlink
return boolean

eof() public method

Tests for end of file on a file pointer
public eof ( resource $f ) : boolean
$f resource File pointer resource
return boolean

exists() public method

Tests if an \ElggFile file exists.
public exists ( ElggFile $file ) : boolean
$file ElggFile File object
return boolean

getFileSize() public method

Returns the file size of an \ElggFile file.
public getFileSize ( ElggFile $file ) : integer
$file ElggFile File object
return integer The file size

getFilenameOnFilestore() public method

Returns an empty string if no filename set
public getFilenameOnFilestore ( ElggFile $file ) : string
$file ElggFile File object
return string The full path of where the file is stored

getParameters() public method

Returns a list of attributes to save to the database when saving the \ElggFile object using this file store.
public getParameters ( ) : array
return array

getSize() public method

Returns the size of all data stored under a directory in the disk store.
public getSize ( string $prefix, string $container_guid ) : integer | false
$prefix string The prefix to check under.
$container_guid string The guid of the entity whose data you want to check.
return integer | false

grabFile() public method

Returns the contents of the \ElggFile file.
public grabFile ( ElggFile $file ) : string
$file ElggFile File object
return string

makeDirectoryRoot() protected method

Create a directory $dirroot
protected makeDirectoryRoot ( string $dirroot ) : true
$dirroot string The full path of the directory to create
return true

open() public method

Open a file for reading, writing, or both.
public open ( ElggFile $file, string $mode ) : resource
$file ElggFile The file to open
$mode string read, write, or append.
return resource File pointer resource

read() public method

Read data from a file.
public read ( resource $f, integer $length, integer $offset ) : mixed
$f resource File pointer resource
$length integer The number of bytes to read
$offset integer The number of bytes to start after
return mixed Contents of file or false on fail.

seek() public method

Seek to the specified position.
public seek ( resource $f, integer $position ) : integer
$f resource File resource
$position integer Position in bytes
return integer 0 for success, or -1

setParameters() public method

Sets parameters that should be saved to database.
public setParameters ( array $parameters ) : boolean
$parameters array Set parameters to save to DB for this filestore.
return boolean

tell() public method

Return the current location of the internal pointer
public tell ( resource $f ) : integer | false
$f resource File pointer resource
return integer | false

write() public method

Write data to a file.
public write ( resource $f, mixed $data ) : boolean
$f resource File pointer resource
$data mixed The data to write.
return boolean