ElggDiskFilestore Class Reference

This class uses disk storage to save data. More...

Inherits ElggFilestore.

Inherited by ElggDiskFilestoreTest.

Collaboration diagram for ElggDiskFilestore:
[legend]

List of all members.

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.

Detailed Description

This class uses disk storage to save data.

Author:
Curverider Ltd

Definition at line 135 of file filestore.php.


Constructor & Destructor Documentation

ElggDiskFilestore.__construct ( directory_root = ""  ) 

Construct a disk filestore using the given directory root.

Parameters:
string $directory_root Root directory, must end in "/"

Definition at line 151 of file filestore.php.

References $CONFIG.


Member Function Documentation

ElggDiskFilestore.close ( f  ) 

Close a given file handle.

Parameters:
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.

Parameters:
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.

Deprecated:
for user directories: use user_file_matrix() instead.
Parameters:
str $filename
Returns:
str

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.

Parameters:
mixed $f The file handle.
Returns:
boolean

Reimplemented from ElggFilestore.

Definition at line 235 of file filestore.php.

ElggDiskFilestore.exists ( ElggFile file  ) 

Return whether a file physically exists or not.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Returns:
array

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.

Parameters:
mixed $file The file handle.
Returns:
mixed The file contents.

Reimplemented from ElggFilestore.

Definition at line 261 of file filestore.php.

References ElggFile.getFilenameOnFilestore().

ElggDiskFilestore.make_directory_root ( dirroot  )  [protected]

Make the directory root.

Parameters:
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.

Parameters:
int | string $identifier
Returns:
str

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.

Parameters:
ElggFile $file
string $mode "read", "write", "append"
Returns:
mixed A handle to the opened file or false on error.

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.

Parameters:
mixed $f The file handle
int $length Length in bytes to read.
int $offset The optional offset.
Returns:
mixed String of data or false on error.

Reimplemented from ElggFilestore.

Definition at line 206 of file filestore.php.

References $offset, and seek().

ElggDiskFilestore.seek ( f,
position 
)

Seek a given position within a file handle.

Parameters:
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.

Parameters:
mixed $f The file handle.
Returns:
int

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.

Parameters:
int $guid
Returns:
str

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.

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

Reimplemented from ElggFilestore.

Definition at line 202 of file filestore.php.

References $data.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations
Generated on Thu Sep 2 00:13:03 2010 for Elgg by  doxygen 1.6.3