Elgg  Version master
Public Member Functions | List of all members
Elgg\Filesystem\Filestore Class Reference

This class defines the interface for all elgg data repositories. More...

Inheritance diagram for Elgg\Filesystem\Filestore:
Elgg\Filesystem\Filestore\DiskFilestore Elgg\Filesystem\Filestore\TempDiskFilestore

Public Member Functions

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

Detailed Description

This class defines the interface for all elgg data repositories.

Definition at line 8 of file Filestore.php.

Member Function Documentation

Elgg\Filesystem\Filestore::close (   $f)
abstract

Close a given file handle.

Parameters
mixed$fThe file handle
Returns
bool
Elgg\Filesystem\Filestore::delete ( \ElggFile  $file,
bool  $follow_symlinks = true 
)
abstract

Delete the file associated with a given file handle.

Parameters
\ElggFile$fileThe file
bool$follow_symlinksIf true, will also delete the target file if the current file is a symlink
Returns
bool
Elgg\Filesystem\Filestore::eof (   $f)
abstract

Return a whether the end of a file has been reached.

Parameters
mixed$fThe file handle.
Returns
boolean
Elgg\Filesystem\Filestore::exists ( \ElggFile  $file)
abstract

Return whether a file physically exists or not.

Parameters
\ElggFile$fileThe file
Returns
bool
Elgg\Filesystem\Filestore::getFilenameOnFilestore ( \ElggFile  $file)
abstract

Return the filename of a given file as stored on the filestore.

Parameters
\ElggFile$fileThe file
Returns
string
Elgg\Filesystem\Filestore::getFileSize ( \ElggFile  $file)
abstract

Return the size in bytes for a given file.

Parameters
\ElggFile$fileThe file
Returns
int
Elgg\Filesystem\Filestore::getParameters ( )
abstract

Get the filestore's creation parameters as an associative array.

Used for serialisation and for storing the creation details along side a file object.

Returns
array
Elgg\Filesystem\Filestore::grabFile ( \ElggFile  $file)
abstract

Get the contents of the whole file.

Parameters
mixed$fileThe file handle.
Returns
mixed The file contents.
Elgg\Filesystem\Filestore::open ( \ElggFile  $file,
string  $mode 
)
abstract

Attempt to open the file $file for storage or writing.

Parameters
\ElggFile$fileA file
string$mode"read", "write", "append"
Returns
mixed A handle to the opened file or false on error.
Elgg\Filesystem\Filestore::read (   $f,
int  $length,
int  $offset = 0 
)
abstract

Read data from a filestore.

Parameters
mixed$fThe file handle
int$lengthLength in bytes to read.
int$offsetThe optional offset.
Returns
mixed String of data or false on error.
Elgg\Filesystem\Filestore::seek (   $f,
int  $position 
)
abstract

Seek a given position within a file handle.

Parameters
mixed$fThe file handle.
int$positionThe position.
Returns
int 0 for success, or -1
Elgg\Filesystem\Filestore::setParameters ( array  $parameters)
abstract

Set the parameters from the associative array produced by $this->getParameters().

Parameters
array$parametersA list of parameters
Returns
bool
Elgg\Filesystem\Filestore::tell (   $f)
abstract

Return the current position in an open file.

Parameters
mixed$fThe file handle.
Returns
int|false
Elgg\Filesystem\Filestore::write (   $f,
string  $data 
)
abstract

Write data to a given file handle.

Parameters
mixed$fThe file handle - exactly what this is depends on the file system
string$dataThe binary string of data to write
Returns
int Number of bytes written

The documentation for this class was generated from the following file: