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])
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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