PHP Class ElggFilestore, Elgg

Author: Curverider Ltd
Mostra file Open project: elgg/elgg

Public Methods

Method Description
close ( mixed $f ) : boolean Close a given file handle.
delete ( ElggFile $file, boolean $follow_symlinks = true ) : boolean Delete the file associated with a given file handle.
eof ( mixed $f ) : boolean Return a whether the end of a file has been reached.
exists ( ElggFile $file ) : boolean Return whether a file physically exists or not.
getFileSize ( ElggFile $file ) : integer Return the size in bytes for a given file.
getFilenameOnFilestore ( ElggFile $file ) : string Return the filename of a given file as stored on the filestore.
getParameters ( ) : array Get the filestore's creation parameters as an associative array.
grabFile ( ElggFile $file ) : mixed Get the contents of the whole file.
open ( ElggFile $file, string $mode ) : mixed Attempt to open the file $file for storage or writing.
read ( mixed $f, integer $length, integer $offset ) : mixed Read data from a filestore.
seek ( mixed $f, integer $position ) : integer Seek a given position within a file handle.
setParameters ( array $parameters ) : boolean Set the parameters from the associative array produced by $this->getParameters().
tell ( mixed $f ) : integer Return the current position in an open file.
write ( mixed $f, string $data ) : integer Write data to a given file handle.

Method Details

close() abstract public method

Close a given file handle.
abstract public close ( mixed $f ) : boolean
$f mixed The file handle
return boolean

delete() abstract public method

Delete the file associated with a given file handle.
abstract public delete ( ElggFile $file, boolean $follow_symlinks = true ) : boolean
$file ElggFile The file
$follow_symlinks boolean If true, will also delete the target file if the current file is a symlink
return boolean

eof() abstract public method

Return a whether the end of a file has been reached.
abstract public eof ( mixed $f ) : boolean
$f mixed The file handle.
return boolean

exists() abstract public method

Return whether a file physically exists or not.
abstract public exists ( ElggFile $file ) : boolean
$file ElggFile The file
return boolean

getFileSize() abstract public method

Return the size in bytes for a given file.
abstract public getFileSize ( ElggFile $file ) : integer
$file ElggFile The file
return integer

getFilenameOnFilestore() abstract public method

Return the filename of a given file as stored on the filestore.
abstract public getFilenameOnFilestore ( ElggFile $file ) : string
$file ElggFile The file
return string

getParameters() abstract public method

Used for serialisation and for storing the creation details along side a file object.
abstract public getParameters ( ) : array
return array

grabFile() abstract public method

Get the contents of the whole file.
abstract public grabFile ( ElggFile $file ) : mixed
$file ElggFile The file handle.
return mixed The file contents.

open() abstract public method

Attempt to open the file $file for storage or writing.
abstract public open ( ElggFile $file, string $mode ) : mixed
$file ElggFile A file
$mode string "read", "write", "append"
return mixed A handle to the opened file or false on error.

read() abstract public method

Read data from a filestore.
abstract public read ( mixed $f, integer $length, integer $offset ) : mixed
$f mixed The file handle
$length integer Length in bytes to read.
$offset integer The optional offset.
return mixed String of data or false on error.

seek() abstract public method

Seek a given position within a file handle.
abstract public seek ( mixed $f, integer $position ) : integer
$f mixed The file handle.
$position integer The position.
return integer 0 for success, or -1

setParameters() abstract public method

Set the parameters from the associative array produced by $this->getParameters().
abstract public setParameters ( array $parameters ) : boolean
$parameters array A list of parameters
return boolean

tell() abstract public method

Return the current position in an open file.
abstract public tell ( mixed $f ) : integer
$f mixed The file handle.
return integer

write() abstract public method

Write data to a given file handle.
abstract public write ( mixed $f, string $data ) : integer
$f mixed The file handle - exactly what this is depends on the file system
$data string The binary string of data to write
return integer Number of bytes written.