Stateless VFS implementation for a SMB server, based on smbclient.
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.
port' - (integer) The SMB port number to connect to.
share - (string) The share to access on the SMB server.
smbclient - (string) The path to the 'smbclient' executable.
Optional values for $params:
ipaddress - (string) The address of the server to connect to.
Functions not implemented:
- changePermissions(): The SMB permission style does not fit with the module.
Codebase copyright 2002 Paul Gareau paul@xhawk.net. Adapted with
permission by Patrice Levesque wayne@ptaff.ca from phpsmb-0.8 code, and
converted to the LGPL. Please do not taunt original author, contact
Patrice Levesque or dev@lists.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
integer
|
#
size( string $path, string $name )
Retrieves the size of a file from the VFS.
Retrieves the size of a file from the VFS.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
Returns
integer The file size.
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
|
#
readFile( string $path, string $name )
Retrieves a file from the VFS as an on-disk local file.
Retrieves a file from the VFS as an on-disk local file.
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.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
Returns
string A local filename.
Throws
Overrides
|
public
resource
|
#
readStream( string $path, string $name )
Open a stream to a file in the VFS.
Open a stream to a file in the VFS.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
Returns
resource The stream.
|
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 )
Stores a file in the VFS from raw data.
Stores 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 )
Deletes a file from the VFS.
Deletes a file from the VFS.
Parameters
- $path
- The path to delete the file from.
- $name
- The filename to use.
Throws
Overrides
|
public
boolean
|
#
isFolder( string $path, string $name )
Checks if a given pathname is a folder.
Checks if a given pathname is a folder.
Parameters
- $path
- The path to the folder.
- $name
- The file or folder name.
Returns
boolean True if it is a folder, false otherwise.
Overrides
|
public
|
#
deleteFolder( string $path, string $name, boolean $recursive = false )
Deletes a folder from the VFS.
Deletes a folder from the VFS.
Parameters
- $path
- The path to delete the folder from.
- $name
- The name of the folder to delete.
- $recursive
- Force a recursive delete?
Throws
Overrides
|
public
|
#
rename( string $oldpath, string $oldname, string $newpath, string $newname )
Renames a file in the VFS.
Renames a file 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
- The path of directory to create folder.
- $name
- The name of the new folder.
Throws
Overrides
|
public
array
|
#
listFolder( string $path = '', mixed $filter = null, boolean $dotfiles = true, boolean $dironly = false, boolean $recursive = false )
Returns an unsorted file list.
Returns an unsorted file list.
Parameters
- $path
- <p>The path of the directory to get the file list
for.</p>
- $filter
- Hash of items to filter based on filename.
- $dotfiles
- <p>Show dotfiles? This is irrelevant with
smbclient.</p>
- $dironly
- Show directories only?
- $recursive
- Return all directory levels recursively?
Returns
array File list.
Throws
Overrides
|
public
|
#
parseListing( mixed $res, mixed $filter, mixed $dotfiles, mixed $dironly )
|
public
array
|
#
listFolders( string $path = '', mixed $filter = null, 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
- Hash of items to filter based on folderlist.
- $dotfolders
- Include dotfolders? Irrelevant for SMB.
Returns
array Folder list.
Throws
Overrides
|
public
|
#
copy( string $path, string $name, string $dest, boolean $autocreate = false )
Copies a file through the backend.
Copies a file through the backend.
Parameters
- $path
- The path to store the file in.
- $name
- The filename to use.
- $dest
- The destination of the file.
- $autocreate
- Automatically create directories?
Throws
Overrides
|
public
|
#
move( string $path, string $name, string $dest, boolean $autocreate = false )
Moves a file through the backend.
Moves a file through the backend.
Parameters
- $path
- The path to store the file in.
- $name
- The filename to use.
- $dest
- The destination of the file.
- $autocreate
- Automatically create directories?
Throws
Overrides
|