Methods summary
public
|
#
__construct( string $directory_root = "" )
Construct a disk filestore using the given directory root.
Construct a disk filestore using the given directory root.
Parameters
- $directory_root
string $directory_root Root directory, must end in "/"
|
public
resource
|
#
open( ElggFile $file, string $mode )
Open a file for reading, writing, or both.
Open a file for reading, writing, or both.
Parameters
- $file
ElggFile
$file The file to open
- $mode
string $mode read, write, or append.
Returns
resource File pointer resource
Throws
Note
All files are opened binary safe.
Warning
This will try to create the a directory if it doesn't exist, even in read-only
mode.
|
public
boolean
|
#
write( resource $f, mixed $data )
Write data to a file.
Parameters
- $f
resource $f File pointer resource
- $data
mixed $data The data to write.
Returns
boolean
|
public
mixed
|
#
read( resource $f, integer $length, integer $offset = 0 )
Read data from a file.
Parameters
- $f
resource $f File pointer resource
- $length
integer $length The number of bytes to read
- $offset
integer $offset The number of bytes to start after
Returns
mixed Contents of file or false on fail.
|
public
boolean
|
#
close( resource $f )
Close a file pointer
Parameters
- $f
resource $f A file pointer resource
Returns
boolean
|
public
boolean
|
#
delete( ElggFile $file )
Delete an ElggFile file.
Parameters
Returns
boolean
|
public
boolean
|
#
seek( resource $f, integer $position )
Seek to the specified position.
Seek to the specified position.
Parameters
- $f
resource $f File resource
- $position
integer $position Position in bytes
Returns
boolean
|
public
integer|false
|
#
tell( resource $f )
Return the current location of the internal pointer
Return the current location of the internal pointer
Parameters
- $f
resource $f File pointer resource
Returns
integer|false
|
public
boolean
|
#
eof( resource $f )
Tests for end of file on a file pointer
Tests for end of file on a file pointer
Parameters
- $f
resource $f File pointer resource
Returns
boolean
|
public
integer
|
#
getFileSize( ElggFile $file )
Returns the file size of an ElggFile file.
Returns the file size of an ElggFile file.
Parameters
Returns
integer The file size
|
public
string
|
#
getFilenameOnFilestore( ElggFile $file )
Get the filename as saved on disk for an ElggFile object
Get the filename as saved on disk for an ElggFile object
Returns an empty string if no filename set
Parameters
Returns
string The full path of where the file is stored
Throws
|
public
string
|
#
grabFile( ElggFile $file )
Returns the contents of the ElggFile file.
Returns the contents of the ElggFile file.
Parameters
Returns
string
|
public
boolean
|
#
exists( ElggFile $file )
Tests if an ElggFile file exists.
Tests if an ElggFile file exists.
Parameters
Returns
boolean
|
public
integer|false
|
#
getSize( string $prefix = '', string $container_guid )
Returns the size of all data stored under a directory in the disk store.
Returns the size of all data stored under a directory in the disk store.
Parameters
- $prefix
string $prefix Optional/ The prefix to check under.
- $container_guid
string $container_guid The guid of the entity whose data you want to check.
Returns
integer|false
|
protected
true
|
#
makeDirectoryRoot( string $dirroot )
Create a directory $dirroot
Create a directory $dirroot
Parameters
- $dirroot
string $dirroot The full path of the directory to create
Returns
true
Throws
|
protected
string
|
#
makeFileMatrix( integer $guid )
Construct a file path matrix for an entity.
Construct a file path matrix for an entity.
Parameters
- $guid
integer $guid The guide of the entity to store the data under.
Returns
string The path where the entity's data will be stored.
|
protected
string
|
#
user_file_matrix( integer $guid )
Construct a filename matrix.
Construct a filename matrix.
Generates a matrix using the entity's creation time and unique guid.
File path matrixes are: YYYY/MM/DD/guid/
Parameters
- $guid
integer $guid The entity to contrust a matrix for
Returns
string The
|
public
array
|
#
getParameters( )
Returns a list of attributes to save to the database when saving the ElggFile
object using this file store.
Returns a list of attributes to save to the database when saving the ElggFile
object using this file store.
Returns
array
|
public
boolean
|
#
setParameters( array $parameters )
Sets parameters that should be saved to database.
Sets parameters that should be saved to database.
Parameters
- $parameters
array $parameters Set parameters to save to DB for this filestore.
Returns
boolean
|