ElggDiskFilestore Class Reference

Inheritance diagram for ElggDiskFilestore:
ElggFilestore

List of all members.

Public Member Functions

 __construct ($directory_root="")
 Construct a disk filestore using the given directory root.
 open (ElggFile $file, $mode)
 Open a file for reading, writing, or both.
 write ($f, $data)
 Write data to a file.
 read ($f, $length, $offset=0)
 Read data from a file.
 close ($f)
 Close a file pointer.
 delete (ElggFile $file)
 Delete an ElggFile file.
 seek ($f, $position)
 Seek to the specified position.
 tell ($f)
 Return the current location of the internal pointer.
 eof ($f)
 Tests for end of file on a file pointer.
 getFileSize (ElggFile $file)
 Returns the file size of an ElggFile file.
 getFilenameOnFilestore (ElggFile $file)
 Get the filename as saved on disk for an ElggFile object.
 grabFile (ElggFile $file)
 Returns the contents of the ElggFile file.
 exists (ElggFile $file)
 Tests if an ElggFile file exists.
 getSize ($prefix, $container_guid)
 Returns the size of all data stored under a directory in the disk store.
 getParameters ()
 Returns a list of attributes to save to the database when saving the ElggFile object using this file store.
 setParameters (array $parameters)
 Sets parameters that should be saved to database.

Public Attributes

const BUCKET_SIZE = 5000
 Number of entries per matrix dir.

Protected Member Functions

 make_directory_root ($dirroot)
 Create a directory $dirroot.
 makeDirectoryRoot ($dirroot)
 Create a directory $dirroot.
 make_file_matrix ($identifier)
 Deprecated methods.
 user_file_matrix ($guid)
 Construct a filename matrix.
 makeFileMatrix ($guid)
 Construct a file path matrix for an entity.

Detailed Description

Definition at line 12 of file ElggDiskFilestore.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 29 of file ElggDiskFilestore.php.


Member Function Documentation

ElggDiskFilestore::close ( f  ) 

Close a file pointer.

Parameters:
resource $f A file pointer resource
Returns:
bool

Reimplemented from ElggFilestore.

Definition at line 135 of file ElggDiskFilestore.php.

ElggDiskFilestore::delete ( ElggFile file  ) 

Delete an ElggFile file.

Parameters:
ElggFile $file File to delete
Returns:
bool

Reimplemented from ElggFilestore.

Definition at line 146 of file ElggDiskFilestore.php.

ElggDiskFilestore::eof ( f  ) 

Tests for end of file on a file pointer.

Parameters:
resource $f File pointer resource
Returns:
bool

Reimplemented from ElggFilestore.

Definition at line 185 of file ElggDiskFilestore.php.

ElggDiskFilestore::exists ( ElggFile file  ) 

Tests if an ElggFile file exists.

Parameters:
ElggFile $file File object
Returns:
bool

Reimplemented from ElggFilestore.

Definition at line 244 of file ElggDiskFilestore.php.

ElggDiskFilestore::getFilenameOnFilestore ( ElggFile file  ) 

Get the filename as saved on disk for an ElggFile object.

Returns an empty string if no filename set

Parameters:
ElggFile $file File object
Returns:
string The full path of where the file is stored
Exceptions:
InvalidParameterException 

Reimplemented from ElggFilestore.

Definition at line 210 of file ElggDiskFilestore.php.

ElggDiskFilestore::getFileSize ( ElggFile file  ) 

Returns the file size of an ElggFile file.

Parameters:
ElggFile $file File object
Returns:
int The file size

Reimplemented from ElggFilestore.

Definition at line 196 of file ElggDiskFilestore.php.

ElggDiskFilestore::getParameters (  ) 

Returns a list of attributes to save to the database when saving the ElggFile object using this file store.

Returns:
array

Reimplemented from ElggFilestore.

Definition at line 309 of file ElggDiskFilestore.php.

ElggDiskFilestore::getSize ( prefix,
container_guid 
)

Returns the size of all data stored under a directory in the disk store.

Parameters:
string $prefix The prefix to check under.
string $container_guid The guid of the entity whose data you want to check.
Returns:
int|false

Definition at line 259 of file ElggDiskFilestore.php.

ElggDiskFilestore::grabFile ( ElggFile file  ) 

Returns the contents of the ElggFile file.

Parameters:
ElggFile $file File object
Returns:
string

Reimplemented from ElggFilestore.

Definition at line 233 of file ElggDiskFilestore.php.

ElggDiskFilestore::make_directory_root ( dirroot  )  [protected]

Create a directory $dirroot.

Parameters:
string $dirroot The full path of the directory to create
Exceptions:
IOException 
Returns:
true

Definition at line 278 of file ElggDiskFilestore.php.

ElggDiskFilestore::make_file_matrix ( identifier  )  [protected]

Deprecated methods.

Construct a file path matrix for an entity.

Parameters:
int $identifier The guid of the entity to store the data under.
Returns:
string The path where the entity's data will be stored.

Definition at line 344 of file ElggDiskFilestore.php.

ElggDiskFilestore::makeDirectoryRoot ( dirroot  )  [protected]

Create a directory $dirroot.

Parameters:
string $dirroot The full path of the directory to create
Exceptions:
IOException 
Returns:
true

Definition at line 293 of file ElggDiskFilestore.php.

ElggDiskFilestore::makeFileMatrix ( guid  )  [protected]

Construct a file path matrix for an entity.

Parameters:
int $guid The guid of the entity to store the data under.
Returns:
str The path where the entity's data will be stored relative to the data dir.

Definition at line 412 of file ElggDiskFilestore.php.

ElggDiskFilestore::open ( ElggFile file,
mode 
)

Open a file for reading, writing, or both.

Note:
All files are opened binary safe.
This will try to create the a directory if it doesn't exist and is opened in write or append mode.
Parameters:
ElggFile $file The file to open
string $mode read, write, or append.
Exceptions:
InvalidParameterException 
Returns:
resource File pointer resource

Reimplemented from ElggFilestore.

Definition at line 53 of file ElggDiskFilestore.php.

ElggDiskFilestore::read ( f,
length,
offset = 0 
)

Read data from a file.

Parameters:
resource $f File pointer resource
int $length The number of bytes to read
int $offset The number of bytes to start after
Returns:
mixed Contents of file or false on fail.

Reimplemented from ElggFilestore.

Definition at line 120 of file ElggDiskFilestore.php.

ElggDiskFilestore::seek ( f,
position 
)

Seek to the specified position.

Parameters:
resource $f File resource
int $position Position in bytes
Returns:
bool

Reimplemented from ElggFilestore.

Definition at line 163 of file ElggDiskFilestore.php.

ElggDiskFilestore::setParameters ( array $  parameters  ) 

Sets parameters that should be saved to database.

Parameters:
array $parameters Set parameters to save to DB for this filestore.
Returns:
bool

Reimplemented from ElggFilestore.

Definition at line 320 of file ElggDiskFilestore.php.

ElggDiskFilestore::tell ( f  ) 

Return the current location of the internal pointer.

Parameters:
resource $f File pointer resource
Returns:
int|false

Reimplemented from ElggFilestore.

Definition at line 174 of file ElggDiskFilestore.php.

ElggDiskFilestore::user_file_matrix ( guid  )  [protected]

Construct a filename matrix.

Generates a matrix using the entity's creation time and unique guid.

Parameters:
int $guid The entity to contrust a matrix for
Returns:
str The

Definition at line 363 of file ElggDiskFilestore.php.

ElggDiskFilestore::write ( f,
data 
)

Write data to a file.

Parameters:
resource $f File pointer resource
mixed $data The data to write.
Returns:
bool

Reimplemented from ElggFilestore.

Definition at line 107 of file ElggDiskFilestore.php.


Member Data Documentation

Number of entries per matrix dir.

You almost certainly don't want to change this.

Definition at line 22 of file ElggDiskFilestore.php.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations
Generated on Wed May 22 00:01:49 2013 for Elgg by  doxygen 1.6.3