This class uses disk storage to save data. More...
Inherits ElggFilestore.
Inherited by ElggDiskFilestoreTest.
Public Member Functions | |
| __construct ($directory_root="") | |
| Construct a disk filestore using the given directory root. | |
| open (ElggFile $file, $mode) | |
| Attempt to open the file $file for storage or writing. | |
| write ($f, $data) | |
| Write data to a given file handle. | |
| read ($f, $length, $offset=0) | |
| Read data from a filestore. | |
| close ($f) | |
| Close a given file handle. | |
| delete (ElggFile $file) | |
| Delete the file associated with a given file handle. | |
| seek ($f, $position) | |
| Seek a given position within a file handle. | |
| tell ($f) | |
| Return the current position in an open file. | |
| eof ($f) | |
| Return a whether the end of a file has been reached. | |
| getFileSize (ElggFile $file) | |
| Return the size in bytes for a given file. | |
| getFilenameOnFilestore (ElggFile $file) | |
| Return the filename of a given file as stored on the filestore. | |
| grabFile (ElggFile $file) | |
| Get the contents of the whole file. | |
| exists (ElggFile $file) | |
| Return whether a file physically exists or not. | |
| getSize ($prefix, $container_guid) | |
| getParameters () | |
| Get the filestore's creation parameters as an associative array. | |
| setParameters (array $parameters) | |
| Set the parameters from the associative array produced by $this->getParameters(). | |
Protected Member Functions | |
| make_directory_root ($dirroot) | |
| Make the directory root. | |
| make_file_matrix ($identifier) | |
| Construct the filename matrix. | |
| user_file_matrix ($guid) | |
| Construct the filename matrix with user info. | |
| deprecated_file_matrix ($filename) | |
| Construct the filename matrix using a string. | |
This class uses disk storage to save data.
Definition at line 135 of file filestore.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 151 of file filestore.php.
References $CONFIG.
| ElggDiskFilestore.close | ( | $ | f | ) |
Close a given file handle.
| mixed | $f |
Reimplemented from ElggFilestore.
Definition at line 214 of file filestore.php.
| ElggDiskFilestore.delete | ( | ElggFile $ | file | ) |
Delete the file associated with a given file handle.
| ElggFile | $file |
Reimplemented from ElggFilestore.
Definition at line 218 of file filestore.php.
References $file, $filename, and getFilenameOnFilestore().
| ElggDiskFilestore.deprecated_file_matrix | ( | $ | filename | ) | [protected] |
Construct the filename matrix using a string.
Particularly, this is used with a username to generate the file storage location.
| str | $filename |
Definition at line 374 of file filestore.php.
References $error, $filename, $user, elgg_log(), and user_file_matrix().
Referenced by make_file_matrix(), and user_file_matrix().
| ElggDiskFilestore.eof | ( | $ | f | ) |
Return a whether the end of a file has been reached.
| mixed | $f The file handle. |
Reimplemented from ElggFilestore.
Definition at line 235 of file filestore.php.
| ElggDiskFilestore.exists | ( | ElggFile $ | file | ) |
Return whether a file physically exists or not.
| ElggFile | $file |
Reimplemented from ElggFilestore.
Definition at line 265 of file filestore.php.
References getFilenameOnFilestore().
| ElggDiskFilestore.getFilenameOnFilestore | ( | ElggFile $ | file | ) |
Return the filename of a given file as stored on the filestore.
| ElggFile | $file |
Reimplemented from ElggFilestore.
Definition at line 243 of file filestore.php.
References $owner, $owner_guid, elgg_echo(), get_loggedin_user(), ElggFile.getFilename(), ElggEntity.getOwnerEntity(), and make_file_matrix().
Referenced by delete(), exists(), getFileSize(), and open().
| ElggDiskFilestore.getFileSize | ( | ElggFile $ | file | ) |
Return the size in bytes for a given file.
| ElggFile | $file |
Reimplemented from ElggFilestore.
Definition at line 239 of file filestore.php.
References getFilenameOnFilestore().
| ElggDiskFilestore.getParameters | ( | ) |
Get the filestore's creation parameters as an associative array.
Used for serialisation and for storing the creation details along side a file object.
Reimplemented from ElggFilestore.
Definition at line 384 of file filestore.php.
| ElggDiskFilestore.getSize | ( | $ | prefix, | |
| $ | container_guid | |||
| ) |
Definition at line 269 of file filestore.php.
References $container_guid, and get_dir_size().
| ElggDiskFilestore.grabFile | ( | ElggFile $ | file | ) |
Get the contents of the whole file.
| mixed | $file The file handle. |
Reimplemented from ElggFilestore.
Definition at line 261 of file filestore.php.
References ElggFile.getFilenameOnFilestore().
| ElggDiskFilestore.make_directory_root | ( | $ | dirroot | ) | [protected] |
Make the directory root.
| string | $dirroot |
Definition at line 282 of file filestore.php.
References elgg_echo().
Referenced by open().
| ElggDiskFilestore.make_file_matrix | ( | $ | identifier | ) | [protected] |
Construct the filename matrix.
| int | | string $identifier |
Reimplemented in ElggDiskFilestoreTest.
Definition at line 328 of file filestore.php.
References deprecated_file_matrix(), and user_file_matrix().
Referenced by getFilenameOnFilestore().
| ElggDiskFilestore.open | ( | ElggFile $ | file, | |
| $ | mode | |||
| ) |
Attempt to open the file $file for storage or writing.
| ElggFile | $file | |
| string | $mode "read", "write", "append" |
Reimplemented from ElggFilestore.
Definition at line 161 of file filestore.php.
References $e, $name, elgg_echo(), getFilenameOnFilestore(), and make_directory_root().
| ElggDiskFilestore.read | ( | $ | f, | |
| $ | length, | |||
| $ | offset = 0 | |||
| ) |
Read data from a filestore.
| mixed | $f The file handle | |
| int | $length Length in bytes to read. | |
| int | $offset The optional offset. |
Reimplemented from ElggFilestore.
Definition at line 206 of file filestore.php.
| ElggDiskFilestore.seek | ( | $ | f, | |
| $ | position | |||
| ) |
Seek a given position within a file handle.
| mixed | $f The file handle. | |
| int | $position The position. |
Reimplemented from ElggFilestore.
Definition at line 227 of file filestore.php.
Referenced by read().
| ElggDiskFilestore.setParameters | ( | array $ | parameters | ) |
Set the parameters from the associative array produced by $this->getParameters().
Reimplemented from ElggFilestore.
Definition at line 388 of file filestore.php.
| ElggDiskFilestore.tell | ( | $ | f | ) |
Return the current position in an open file.
| mixed | $f The file handle. |
Reimplemented from ElggFilestore.
Definition at line 231 of file filestore.php.
| ElggDiskFilestore.user_file_matrix | ( | $ | guid | ) | [protected] |
Construct the filename matrix with user info.
This method will generate a matrix using the entity's creation time and unique guid. This is intended only to determine a user's data directory.
| int | $guid |
Reimplemented in ElggDiskFilestoreTest.
Definition at line 345 of file filestore.php.
References $guid, $user, deprecated_file_matrix(), and get_entity().
Referenced by deprecated_file_matrix(), and make_file_matrix().
| ElggDiskFilestore.write | ( | $ | f, | |
| $ | data | |||
| ) |
Write data to a given file handle.
| mixed | $f The file handle - exactly what this is depends on the file system | |
| string | $data The binary string of data to write |
Reimplemented from ElggFilestore.
Definition at line 202 of file filestore.php.
References $data.
1.6.3