Elgg
Version 1.11
|
Public Member Functions | |
__construct ($directory_root="") | |
Construct a disk filestore using the given directory root. More... | |
open (\ElggFile $file, $mode) | |
Open a file for reading, writing, or both. More... | |
write ($f, $data) | |
Write data to a file. More... | |
read ($f, $length, $offset=0) | |
Read data from a file. More... | |
close ($f) | |
Close a file pointer. More... | |
delete (\ElggFile $file) | |
Delete an file. More... | |
seek ($f, $position) | |
Seek to the specified position. More... | |
tell ($f) | |
Return the current location of the internal pointer. More... | |
eof ($f) | |
Tests for end of file on a file pointer. More... | |
getFileSize (\ElggFile $file) | |
Returns the file size of an file. More... | |
getFilenameOnFilestore (\ElggFile $file) | |
Get the filename as saved on disk for an object. More... | |
grabFile (\ElggFile $file) | |
Returns the contents of the file. More... | |
exists (\ElggFile $file) | |
Tests if an file exists. More... | |
getSize ($prefix, $container_guid) | |
Returns the size of all data stored under a directory in the disk store. More... | |
getParameters () | |
Returns a list of attributes to save to the database when saving the object using this file store. More... | |
setParameters (array $parameters) | |
Sets parameters that should be saved to database. More... | |
Public Member Functions inherited from ElggFilestore | |
open (\ElggFile $file, $mode) | |
Attempt to open the file $file for storage or writing. More... | |
write ($f, $data) | |
Write data to a given file handle. More... | |
read ($f, $length, $offset=0) | |
Read data from a filestore. More... | |
seek ($f, $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) | |
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... | |
Public Attributes | |
const | BUCKET_SIZE = 5000 |
Number of entries per matrix dir. More... | |
Protected Member Functions | |
make_directory_root ($dirroot) | |
Create a directory $dirroot. More... | |
makeDirectoryRoot ($dirroot) | |
Create a directory $dirroot. More... | |
make_file_matrix ($identifier) | |
Deprecated methods. More... | |
user_file_matrix ($guid) | |
Construct a filename matrix. More... | |
makeFileMatrix ($guid) | |
Construct a file path matrix for an entity. More... | |
Definition at line 11 of file ElggDiskFilestore.php.
ElggDiskFilestore::__construct | ( | $directory_root = "" | ) |
Construct a disk filestore using the given directory root.
string | $directory_root | Root directory, must end in "/" |
Definition at line 35 of file ElggDiskFilestore.php.
ElggDiskFilestore::close | ( | $f | ) |
Close a file pointer.
resource | $f | A file pointer resource |
Definition at line 140 of file ElggDiskFilestore.php.
ElggDiskFilestore::delete | ( | \ElggFile | $file | ) |
Delete an file.
\ElggFile | $file | File to delete |
Definition at line 151 of file ElggDiskFilestore.php.
ElggDiskFilestore::eof | ( | $f | ) |
Tests for end of file on a file pointer.
resource | $f | File pointer resource |
Definition at line 190 of file ElggDiskFilestore.php.
ElggDiskFilestore::exists | ( | \ElggFile | $file | ) |
Tests if an file exists.
\ElggFile | $file | File object |
Definition at line 254 of file ElggDiskFilestore.php.
ElggDiskFilestore::getFilenameOnFilestore | ( | \ElggFile | $file | ) |
Get the filename as saved on disk for an object.
Returns an empty string if no filename set
\ElggFile | $file | File object |
InvalidParameterException |
Definition at line 215 of file ElggDiskFilestore.php.
ElggDiskFilestore::getFileSize | ( | \ElggFile | $file | ) |
Returns the file size of an file.
\ElggFile | $file | File object |
Definition at line 201 of file ElggDiskFilestore.php.
ElggDiskFilestore::getParameters | ( | ) |
Returns a list of attributes to save to the database when saving the object using this file store.
Definition at line 319 of file ElggDiskFilestore.php.
ElggDiskFilestore::getSize | ( | $prefix, | |
$container_guid | |||
) |
Returns the size of all data stored under a directory in the disk store.
string | $prefix | The prefix to check under. |
string | $container_guid | The guid of the entity whose data you want to check. |
Definition at line 269 of file ElggDiskFilestore.php.
ElggDiskFilestore::grabFile | ( | \ElggFile | $file | ) |
Returns the contents of the file.
\ElggFile | $file | File object |
Definition at line 243 of file ElggDiskFilestore.php.
|
protected |
Create a directory $dirroot.
string | $dirroot | The full path of the directory to create |
IOException |
Definition at line 288 of file ElggDiskFilestore.php.
|
protected |
Deprecated methods.
Construct a file path matrix for an entity.
int | $identifier | The guid of the entity to store the data under. |
Definition at line 354 of file ElggDiskFilestore.php.
|
protected |
Create a directory $dirroot.
string | $dirroot | The full path of the directory to create |
IOException |
Definition at line 303 of file ElggDiskFilestore.php.
|
protected |
Construct a file path matrix for an entity.
int | $guid | The guid of the entity to store the data under. |
Definition at line 422 of file ElggDiskFilestore.php.
ElggDiskFilestore::open | ( | \ElggFile | $file, |
$mode | |||
) |
Open a file for reading, writing, or both.
\ElggFile | $file | The file to open |
string | $mode | read, write, or append. |
InvalidParameterException |
Definition at line 60 of file ElggDiskFilestore.php.
ElggDiskFilestore::read | ( | $f, | |
$length, | |||
$offset = 0 |
|||
) |
Read data from a file.
resource | $f | File pointer resource |
int | $length | The number of bytes to read |
int | $offset | The number of bytes to start after |
Definition at line 125 of file ElggDiskFilestore.php.
ElggDiskFilestore::seek | ( | $f, | |
$position | |||
) |
Seek to the specified position.
resource | $f | File resource |
int | $position | Position in bytes |
Definition at line 168 of file ElggDiskFilestore.php.
ElggDiskFilestore::setParameters | ( | array | $parameters | ) |
Sets parameters that should be saved to database.
array | $parameters | Set parameters to save to DB for this filestore. |
Definition at line 330 of file ElggDiskFilestore.php.
ElggDiskFilestore::tell | ( | $f | ) |
Return the current location of the internal pointer.
resource | $f | File pointer resource |
Definition at line 179 of file ElggDiskFilestore.php.
|
protected |
Construct a filename matrix.
Generates a matrix using the entity's creation time and unique guid.
int | $guid | The entity to contrust a matrix for |
Definition at line 373 of file ElggDiskFilestore.php.
ElggDiskFilestore::write | ( | $f, | |
$data | |||
) |
Write data to a file.
resource | $f | File pointer resource |
mixed | $data | The data to write. |
Definition at line 112 of file ElggDiskFilestore.php.
const ElggDiskFilestore::BUCKET_SIZE = 5000 |
Number of entries per matrix dir.
You almost certainly don't want to change this.
Definition at line 21 of file ElggDiskFilestore.php.