PHP Class Horde_Vfs_Mongo, horde

Author: Michael Slusarz ([email protected])
Inheritance: extends Horde_Vfs_Base
Datei anzeigen Open project: horde/horde

Protected Properties

Property Type Description
$_files MongoGridFS The MongoDB GridFS object for the VFS data.
$_folders MongoGridCollection The MongoDB collection for the VFS folder data.

Public Methods

Method Description
__construct ( array $params = [] ) Constructor.
createFolder ( $path, $name )
deleteFile ( $path, $name )
deleteFolder ( $path, $name, $recursive = false )
emptyFolder ( $path )
gc ( $path, $secs = 345600 )
getFolderSize ( $path = null )
isFolder ( $path, $name )
read ( $path, $name )
readByteRange ( $path, $name, &$offset, $length, &$remaining )
readStream ( string $path, string $name ) : resource Open a read-only stream to a file in the VFS.
rename ( $oldpath, $oldname, $newpath, $newname )
size ( $path, $name )
write ( $path, $name, $tmpFile, $autocreate = false )
writeData ( $path, $name, $data, $autocreate = false )

Protected Methods

Method Description
_convertPath ( string $path ) : string Converts the path name from regular filesystem form to the internal format needed to access the file in the database.
_getFile ( $path, $name )
_isFolder ( $path )
_listFolder ( string $path, mixed $filter = null, boolean $dotfiles = true, boolean $dironly = false ) : array Returns an an unsorted file list of the specified directory.
_mdKey ( $key )
_write ( $type, $path, $name, $data, $autocreate )

Method Details

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array Additional parameters:
  - collection: (string) The collection name for the folders data.
  - gridfs: (string) The GridFS name.
  - mongo_db: [REQUIRED] (Horde_Mongo_Client) A MongoDB client object.

_convertPath() protected method

Namely, we will treat '/' as a base directory as this is pretty much the standard way to access base directories over most filesystems.
protected _convertPath ( string $path ) : string
$path string A VFS path.
return string The path with any surrouding slashes stripped off.

_getFile() protected method

protected _getFile ( $path, $name )

_isFolder() protected method

protected _isFolder ( $path )

_listFolder() protected method

Returns an an unsorted file list of the specified directory.
protected _listFolder ( string $path, mixed $filter = null, boolean $dotfiles = true, boolean $dironly = false ) : array
$path string The path of the directory.
$filter mixed String/hash to filter file/dirname on.
$dotfiles boolean Show dotfiles?
$dironly boolean Show only directories?
return array File list.

_mdKey() protected method

protected _mdKey ( $key )

_write() protected method

protected _write ( $type, $path, $name, $data, $autocreate )

createFolder() public method

public createFolder ( $path, $name )

deleteFile() public method

public deleteFile ( $path, $name )

deleteFolder() public method

public deleteFolder ( $path, $name, $recursive = false )

emptyFolder() public method

public emptyFolder ( $path )

gc() public method

public gc ( $path, $secs = 345600 )

getFolderSize() public method

public getFolderSize ( $path = null )

isFolder() public method

public isFolder ( $path, $name )

read() public method

public read ( $path, $name )

readByteRange() public method

public readByteRange ( $path, $name, &$offset, $length, &$remaining )

readStream() public method

Open a read-only stream to a file in the VFS.
public readStream ( string $path, string $name ) : resource
$path string The pathname to the file.
$name string The filename to retrieve.
return resource The stream.

rename() public method

public rename ( $oldpath, $oldname, $newpath, $newname )

size() public method

public size ( $path, $name )

write() public method

public write ( $path, $name, $tmpFile, $autocreate = false )

writeData() public method

public writeData ( $path, $name, $data, $autocreate = false )

Property Details

$_files protected_oe property

The MongoDB GridFS object for the VFS data.
protected MongoGridFS $_files
return MongoGridFS

$_folders protected_oe property

The MongoDB collection for the VFS folder data.
protected MongoGridCollection $_folders
return MongoGridCollection