VFS implementation for Horde's database abstraction layer.
Required values for $params:
- db: A Horde_Db_Adapter object.
Optional values:
- table: (string) The name of the vfs table in 'database'. Defaults to 'horde_vfs'.
The table structure for the VFS can be created with the horde-db-migrate
script from the Horde_Db package.
Copyright 2002-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.
Methods summary
public
|
#
__construct( array $params = array() )
Constructor.
Parameters
- $params
- A hash containing connection parameters.
Overrides
|
public
integer
|
#
size( string $path, string $name )
Retrieves the filesize from the VFS.
Retrieves the filesize from the VFS.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
Returns
integer The file size.
Throws
Overrides
|
public
integer
|
#
getFolderSize( string $path = null, string $name = null )
Returns the size of a file.
Returns the size of a file.
Parameters
- $path
- The path of the file.
- $name
- The filename.
Returns
integer The size of the folder in bytes.
Throws
Overrides
|
public
string
|
#
read( string $path, string $name )
Retrieves a file from the VFS.
Retrieves a file from the VFS.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
Returns
string The file data.
Throws
Overrides
|
public
string
|
#
readByteRange( string $path, string $name, integer & $offset, integer $length, integer & $remaining )
Retrieves a part of a file from the VFS. Particularly useful
when reading large files which would exceed the PHP memory
limits if they were stored in a string.
Retrieves a part of a file from the VFS. Particularly useful
when reading large files which would exceed the PHP memory
limits if they were stored in a string.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
- $offset
- <p>The offset of the part. (The new offset will
be stored in here).</p>
- $length
- <p>The length of the part. If the length = -1,
the whole part after the offset is
retrieved. If more bytes are given as exists
after the given offset. Only the available
bytes are read.</p>
- $remaining
- <p>The bytes that are left, after the part that
is retrieved.</p>
Returns
string The file data.
Throws
Overrides
|
public
|
#
write( string $path, string $name, string $tmpFile, boolean $autocreate = false )
Stores a file in the VFS.
Stores a file in the VFS.
Parameters
- $path
- The path to store the file in.
- $name
- The filename to use.
- $tmpFile
- <p>The temporary file containing the data to
be stored.</p>
- $autocreate
- Automatically create directories?
Throws
Overrides
|
public
|
#
writeData( string $path, string $name, string $data, boolean $autocreate = false )
Store a file in the VFS from raw data.
Store a file in the VFS from raw data.
Parameters
- $path
- The path to store the file in.
- $name
- The filename to use.
- $data
- The file data.
- $autocreate
- Automatically create directories?
Throws
Overrides
|
public
|
#
deleteFile( string $path, string $name )
Delete a file from the VFS.
Delete a file from the VFS.
Parameters
- $path
- The path to store the file in.
- $name
- The filename to use.
Throws
Overrides
|
public
|
#
rename( string $oldpath, string $oldname, string $newpath, string $newname )
Rename a file or folder in the VFS.
Rename a file or folder in the VFS.
Parameters
- $oldpath
- The old path to the file.
- $oldname
- The old filename.
- $newpath
- The new path of the file.
- $newname
- The new filename.
Throws
Overrides
|
public
|
#
createFolder( string $path, string $name )
Creates a folder on the VFS.
Creates a folder on the VFS.
Parameters
- $path
- Holds the path of directory to create folder.
- $name
- Holds the name of the new folder.
Throws
Overrides
|
public
|
#
deleteFolder( string $path, string $name, boolean $recursive = false )
Delete a folder from the VFS.
Delete a folder from the VFS.
Parameters
- $path
- The path of the folder.
- $name
- The folder name to use.
- $recursive
- Force a recursive delete?
Throws
Overrides
|
public
array
|
#
listFolders( string $path = '', mixed $filter = array(), boolean $dotfolders = true )
Returns a sorted list of folders in specified directory.
Returns a sorted list of folders in specified directory.
Parameters
- $path
- <p>The path of the directory to get the
directory list for.</p>
- $filter
- <p>String/hash of items to filter based on
folderlist.</p>
- $dotfolders
- Include dotfolders?
Returns
array Folder list.
Throws
Overrides
|
public
|
#
gc( string $path, integer $secs = 345600 )
Garbage collect files in the VFS storage system.
Garbage collect files in the VFS storage system.
Parameters
- $path
- The VFS path to clean.
- $secs
- <p>The minimum amount of time (in seconds) required
before a file is removed.</p>
Throws
|
public
boolean
|
#
isFolder( string $path, string $name )
Horde_Vfs_Sql override of isFolder() to check for root folder.
Horde_Vfs_Sql override of isFolder() to check for root folder.
Parameters
- $path
- Path to possible folder
- $name
- Name of possible folder
Returns
boolean True if $path/$name is a folder
Overrides
|