PHP Класс Horde_Vfs_Smb, horde

Required values for $params: - username: (string) The username with which to connect to the SMB server. - password: (string) The password with which to connect to the SMB server. - hostspec: (string) The SMB server to connect to. - share: (string) The share to access on the SMB server. Any trailing paths will removed from the share and prepended to each path in further requests. Example: a share of 'myshare/basedir' and a request to 'dir/subdir' will result in a request to 'basedir/dir/subdir' on myshare. - smbclient: (string) The path to the 'smbclient' executable. Optional values for $params: - port: (integer) The SMB port number to connect to. - ipaddress: (string) The address of the server to connect to. Functions not implemented: - changePermissions(): The SMB permission style does not fit with the module. All paths need to use forward slashes!
Автор: Paul Gareau ([email protected])
Автор: Patrice Levesque ([email protected])
Наследование: extends Horde_Vfs_Base
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_credentials array List of additional credentials required for this VFS backend.
$_prefix string Passed as a path suffix to the share parameter.
$_rootCreated boolean Has the vfsroot already been created?

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

Метод Описание
__construct ( array $params = [] ) Constructor.
copy ( string $path, string $name, string $dest, boolean $autocreate = false ) Copies a file through the backend.
createFolder ( string $path, string $name ) Creates a folder on the VFS.
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.
isFolder ( string $path, string $name ) : boolean Checks if a given pathname 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.
parseListing ( $res, $filter, $dotfiles, $dironly )
read ( string $path, string $name ) : string Retrieves a file from the VFS.
readFile ( string $path, string $name ) : string Retrieves a file from the VFS as an on-disk local file.
readStream ( string $path, string $name ) : resource Open a stream to a file in the VFS.
rename ( string $oldpath, string $oldname, string $newpath, string $newname ) Renames a file in the VFS.
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.

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

Метод Описание
_command ( array $path, array $cmd ) : array Executes SMB commands - without authentication - and returns output lines in array.
_connect ( ) Authenticates a user on the SMB server and share.
_createRoot ( ) Creates the vfsroot.
_escapeShellCommand ( ) : array Replacement for escapeshellcmd(), variable length args, as we only want certain characters escaped.
_execute ( string $cmd ) : array Executes a command and returns output lines in array.
_getNativePath ( string $path ) : string Returns the full path of a directory.

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

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

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

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

Executes SMB commands - without authentication - and returns output lines in array.
protected _command ( array $path, array $cmd ) : array
$path array Base path for command.
$cmd array Commands to be executed.
Результат array Array on success.

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

Authenticates a user on the SMB server and share.
protected _connect ( )

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

Creates the vfsroot.
protected _createRoot ( )

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

Replacement for escapeshellcmd(), variable length args, as we only want certain characters escaped.
protected _escapeShellCommand ( ) : array
Результат array TODO

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

Executes a command and returns output lines in array.
protected _execute ( string $cmd ) : array
$cmd string Command to be executed.
Результат array Array on success.

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

Returns the full path of a directory.
protected _getNativePath ( string $path ) : string
$path string The directory.
Результат string Full path to the directory.

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

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

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

Creates a folder on the VFS.
public createFolder ( string $path, string $name )
$path string The path of directory to create folder.
$name string The name of the new folder.

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 use.

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

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

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

Checks if a given pathname is a folder.
public isFolder ( string $path, string $name ) : boolean
$path string The path to the folder.
$name string The file or folder 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 to store the file in.
$name string The filename to use.
$dest string The destination of the file.
$autocreate boolean Automatically create directories?

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

public parseListing ( $res, $filter, $dotfiles, $dironly )

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.

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.

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

Open a 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.
Результат resource The stream.

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.

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.
protected array $_credentials
Результат array

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

Passed as a path suffix to the share parameter.
protected string $_prefix
Результат string

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

Has the vfsroot already been created?
protected bool $_rootCreated
Результат boolean