PHP Класс Horde_Vfs_Base, horde

Copyright 2002-2016 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.
Автор: Chuck Hagenbuch ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_credentials array List of additional credentials required for this VFS backend (example: For FTP, we need a username and password to log in to the server with).
$_features array List of features that the VFS driver supports.
$_params array Hash containing connection parameters.
$_permissions array List of permissions and if they can be changed in this VFS backend.
$_vfsSize integer The current size, in bytes, of the VFS tree.

Открытые методы

Метод Описание
__construct ( array $params = [] ) Constructor.
autocreatePath ( string $path ) Automatically creates any necessary parent directories in the specified $path.
changePermissions ( string $path, string $name, string $permission ) Changes permissions for an item on the VFS.
checkCredentials ( ) Checks the credentials that we have by calling _connect(), to see if there is a valid login.
copy ( string $path, string $name, string $dest, boolean $autocreate = false ) Copies a file through the backend.
createFolder ( string $path, string $name ) Creates a folder in the VFS.
delete ( $path, $name ) Alias to deleteFile()
deleteFile ( string $path, string $name ) Deletes a file from the VFS.
deleteFolder ( string $path, string $name, boolean $recursive = false ) Deletes a folder from the VFS.
emptyFolder ( string $path ) Recursively remove all files and subfolders from the given folder.
exists ( string $path, string $name ) : boolean Returns if a given file or folder exists in a folder.
getCurrentDirectory ( ) : string Returns the current working directory of the VFS backend.
getFolderSize ( string $path = null ) : integer Returns the size of a folder.
getModifiablePermissions ( ) : array Returns an array specifying what permissions are changeable for this VFS implementation.
getParam ( string $name ) : mixed Returns configuration parameters.
getQuota ( ) : mixed Get quota information (used/allocated), in bytes.
getRequiredCredentials ( ) : array Returns the list of additional credentials required, if any.
getVFSSize ( ) : integer Returns the size of the VFS item.
hasFeature ( string $feature ) : boolean Returns whether the drivers supports a certain feature.
isFolder ( string $path, string $name ) : boolean Checks if a given item is a folder.
listFolder ( string $path, string | array $filter = null, boolean $dotfiles = true, boolean $dironly = false, boolean $recursive = false ) : array Returns a file list of the directory passed in.
move ( string $path, string $name, string $dest, boolean $autocreate = false ) Moves a file through the backend.
read ( string $path, string $name ) : string Retrieves a file from the VFS.
readByteRange ( string $path, string $name, integer &$offset, integer $length, integer &$remaining ) : 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.
readFile ( string $path, string $name ) : string Retrieves a file from the VFS as an on-disk local file.
rename ( string $oldpath, string $oldname, string $newpath, string $newname ) Renames a file in the VFS.
setParams ( array $params = [] ) Sets configuration parameters.
setQuota ( integer $quota, integer $metric = Horde_Vfs::QUOTA_METRIC_BYTE ) Sets the VFS quota limit.
setQuotaRoot ( string $dir ) Sets the VFS quota root.
size ( string $path, string $name ) : integer Retrieves the size of a file from the VFS.
write ( string $path, string $name, string $tmpFile, boolean $autocreate = false ) Stores a file in the VFS.
writeData ( string $path, string $name, string $data, boolean $autocreate = false ) Stores a file in the VFS from raw data.

Защищенные методы

Метод Описание
_checkDestination ( string $path, string $dest ) Checks whether a source and destination directory are the same.
_checkQuotaDelete ( string $path, string $name ) Checks the quota when preparing to delete data.
_checkQuotaWrite ( string $mode, string $data, string $path = null, string $name = null ) Checks the quota when preparing to write data.
_connect ( ) TODO
_copyRecursive ( string $path, string $name, string $dest ) Recursively copies a directory through the backend.
_filterMatch ( string | array $filter, string $filename ) : boolean Returns whether or not a file or directory name matches an filter element.
_getPath ( string $path, string $name ) : mixed Returns the full path of an item.
_listFolder ( string $path, string | array $filter = null, boolean $dotfiles = true, boolean $dironly = false ) : array Returns an an unsorted file list of the specified directory.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( array $params = [] )
$params array A hash containing connection parameters.

_checkDestination() защищенный Метод

Checks whether a source and destination directory are the same.
protected _checkDestination ( string $path, string $dest )
$path string A source path.
$dest string A destination path.

_checkQuotaDelete() защищенный Метод

Checks the quota when preparing to delete data.
protected _checkQuotaDelete ( string $path, string $name )
$path string The path the file is located in.
$name string The filename.

_checkQuotaWrite() защищенный Метод

Checks the quota when preparing to write data.
protected _checkQuotaWrite ( string $mode, string $data, string $path = null, string $name = null )
$mode string Either 'string' or 'file'. If 'string', $data is the data to be written. If 'file', $data is the filename containing the data to be written.
$data string Either the data or the filename to the data.
$path string The path the file is located in.
$name string The filename.

_connect() защищенный Метод

TODO
protected _connect ( )

_copyRecursive() защищенный Метод

Recursively copies a directory through the backend.
protected _copyRecursive ( string $path, string $name, string $dest )
$path string The path of the original file.
$name string The name of the original file.
$dest string The name of the destination directory.

_filterMatch() защищенный Метод

Returns whether or not a file or directory name matches an filter element.
protected _filterMatch ( string | array $filter, string $filename ) : boolean
$filter string | array Regular expression(s) to build the filter from.
$filename string String containing the file/directory name to match.
Результат boolean True on match, false on no match.

_getPath() защищенный Метод

Returns the full path of an item.
protected _getPath ( string $path, string $name ) : mixed
$path string The path of directory of the item.
$name string The name of the item.
Результат mixed Full path when $path isset and just $name when not set.

_listFolder() защищенный Метод

Returns an an unsorted file list of the specified directory.
protected _listFolder ( string $path, string | array $filter = null, boolean $dotfiles = true, boolean $dironly = false ) : array
$path string The path of the directory.
$filter string | array Regular expression(s) to filter file/directory name on.
$dotfiles boolean Show dotfiles?
$dironly boolean Show only directories?
Результат array File list.

autocreatePath() публичный Метод

Automatically creates any necessary parent directories in the specified $path.
public autocreatePath ( string $path )
$path string The VFS path to autocreate.

changePermissions() публичный Метод

Changes permissions for an item on the VFS.
public changePermissions ( string $path, string $name, string $permission )
$path string The parent folder of the item.
$name string The name of the item.
$permission string The permission to set.

checkCredentials() публичный Метод

Checks the credentials that we have by calling _connect(), to see if there is a valid login.
public checkCredentials ( )

copy() публичный Метод

Copies a file through the backend.
public copy ( string $path, string $name, string $dest, boolean $autocreate = false )
$path string The path of the original file.
$name string The name of the original file.
$dest string The name of the destination directory.
$autocreate boolean Automatically create directories?

createFolder() публичный Метод

Creates a folder in the VFS.
public createFolder ( string $path, string $name )
$path string The parent folder.
$name string The name of the new folder.

delete() публичный Метод

Alias to deleteFile()
public delete ( $path, $name )

deleteFile() публичный Метод

Deletes a file from the VFS.
public deleteFile ( string $path, string $name )
$path string The path to delete the file from.
$name string The filename to delete.

deleteFolder() публичный Метод

Deletes a folder from the VFS.
public deleteFolder ( string $path, string $name, boolean $recursive = false )
$path string The parent folder.
$name string The name of the folder to delete.
$recursive boolean Force a recursive delete?

emptyFolder() публичный Метод

Recursively remove all files and subfolders from the given folder.
public emptyFolder ( string $path )
$path string The path of the folder to empty.

exists() публичный Метод

Returns if a given file or folder exists in a folder.
public exists ( string $path, string $name ) : boolean
$path string The path to the folder.
$name string The file or folder name.
Результат boolean True if it exists, false otherwise.

getCurrentDirectory() публичный Метод

Returns the current working directory of the VFS backend.
public getCurrentDirectory ( ) : string
Результат string The current working directory.

getFolderSize() публичный Метод

Returns the size of a folder.
public getFolderSize ( string $path = null ) : integer
$path string The path of the folder.
Результат integer The size of the folder, in bytes.

getModifiablePermissions() публичный Метод

Returns an array specifying what permissions are changeable for this VFS implementation.
public getModifiablePermissions ( ) : array
Результат array Changeable permisions.

getParam() публичный Метод

Returns configuration parameters.
public getParam ( string $name ) : mixed
$name string The parameter to return.
Результат mixed The parameter value or null if it doesn't exist.

getQuota() публичный Метод

Get quota information (used/allocated), in bytes.
public getQuota ( ) : mixed
Результат mixed An associative array.
'limit' = Maximum quota allowed
'usage' = Currently used portion of quota (in bytes)

getRequiredCredentials() публичный Метод

Returns the list of additional credentials required, if any.
public getRequiredCredentials ( ) : array
Результат array Credential list.

getVFSSize() публичный Метод

Returns the size of the VFS item.
public getVFSSize ( ) : integer
Результат integer The size, in bytes, of the VFS item.

hasFeature() публичный Метод

Returns whether the drivers supports a certain feature.
public hasFeature ( string $feature ) : boolean
$feature string A feature name. See {@link $_features} for a list of possible features.
Результат boolean True if the feature is supported.

isFolder() публичный Метод

Checks if a given item is a folder.
public isFolder ( string $path, string $name ) : boolean
$path string The parent folder.
$name string The item name.
Результат boolean True if it is a folder, false otherwise.

listFolder() публичный Метод

Returns a file list of the directory passed in.
public listFolder ( string $path, string | array $filter = null, boolean $dotfiles = true, boolean $dironly = false, boolean $recursive = false ) : array
$path string The path of the directory.
$filter string | array Regular expression(s) to filter file/directory name on.
$dotfiles boolean Show dotfiles?
$dironly boolean Show only directories?
$recursive boolean Return all directory levels recursively?
Результат array File list.

move() публичный Метод

Moves a file through the backend.
public move ( string $path, string $name, string $dest, boolean $autocreate = false )
$path string The path of the original file.
$name string The name of the original file.
$dest string The destination file name.
$autocreate boolean Automatically create directories?

read() публичный Метод

Retrieves a file from the VFS.
public read ( string $path, string $name ) : string
$path string The pathname to the file.
$name string The filename to retrieve.
Результат string The file data.

readByteRange() публичный Метод

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.
public readByteRange ( string $path, string $name, integer &$offset, integer $length, integer &$remaining ) : string
$path string The pathname to the file.
$name string The filename to retrieve.
$offset integer The offset of the part. (The new offset will be stored in here).
$length integer 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.
$remaining integer The bytes that are left, after the part that is retrieved.
Результат string The file data.

readFile() публичный Метод

This function provides a file on local disk with the data of a VFS file in it. This file cannot be modified! The behavior if you do modify it is undefined. It will be removed at the end of the request.
public readFile ( string $path, string $name ) : string
$path string The pathname to the file.
$name string The filename to retrieve.
Результат string A local filename.

rename() публичный Метод

Renames a file in the VFS.
public rename ( string $oldpath, string $oldname, string $newpath, string $newname )
$oldpath string The old path to the file.
$oldname string The old filename.
$newpath string The new path of the file.
$newname string The new filename.

setParams() публичный Метод

Sets configuration parameters.
public setParams ( array $params = [] )
$params array An associative array with parameter names as keys.

setQuota() публичный Метод

Sets the VFS quota limit.
public setQuota ( integer $quota, integer $metric = Horde_Vfs::QUOTA_METRIC_BYTE )
$quota integer The limit to apply.
$metric integer The metric to multiply the quota into.

setQuotaRoot() публичный Метод

Sets the VFS quota root.
public setQuotaRoot ( string $dir )
$dir string The root directory for the quota determination.

size() публичный Метод

Retrieves the size of a file from the VFS.
public size ( string $path, string $name ) : integer
$path string The pathname to the file.
$name string The filename to retrieve.
Результат integer The file size.

write() публичный Метод

Stores a file in the VFS.
public write ( string $path, string $name, string $tmpFile, boolean $autocreate = false )
$path string The path to store the file in.
$name string The filename to use.
$tmpFile string The temporary file containing the data to be stored.
$autocreate boolean Automatically create directories?

writeData() публичный Метод

Stores a file in the VFS from raw data.
public writeData ( string $path, string $name, string $data, boolean $autocreate = false )
$path string The path to store the file in.
$name string The filename to use.
$data string The file data.
$autocreate boolean Automatically create directories?

Описание свойств

$_credentials защищенное свойство

List of additional credentials required for this VFS backend (example: For FTP, we need a username and password to log in to the server with).
protected array $_credentials
Результат array

$_features защищенное свойство

List of features that the VFS driver supports.
protected array $_features
Результат array

$_params защищенное свойство

Hash containing connection parameters.
protected array $_params
Результат array

$_permissions защищенное свойство

List of permissions and if they can be changed in this VFS backend.
protected array $_permissions
Результат array

$_vfsSize защищенное свойство

The current size, in bytes, of the VFS tree.
protected int $_vfsSize
Результат integer