VFS implementation for an SSH2 server.
This module requires the SSH2 (version 0.10+) PECL package.
Required values for $params:
username - (string) The username with which to connect to the ssh2 server.
password - (string) The password with which to connect to the ssh2 server.
hostspec - (string) The ssh2 server to connect to.
Optional values for $params:
port - (integer) The port used to connect to the ssh2 server if other than
22.
Copyright 2006-2012 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.
Methods summary
public
integer
|
#
size( string $path, string $name )
Returns the size of a file.
Returns the size of a file.
Parameters
- $path
- The path of the file.
- $name
- The filename.
Returns
integer The size of the file in bytes.
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.
Throws
|
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 delete.
Throws
Overrides
|
public
boolean
|
#
isFolder( string $path, string $name )
Checks if a given item is a folder.
Checks if a given item is a folder.
Parameters
- $path
- The parent folder.
- $name
- The item 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 parent folder.
- $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 parent folder.
- $name
- The name of the new folder.
Throws
Overrides
|
public
|
#
changePermissions( string $path, string $name, string $permission )
Changes permissions for an item on the VFS.
Changes permissions for an item on the VFS.
Parameters
- $path
- The parent folder of the item.
- $name
- The name of the item.
- $permission
- The permission to set in octal notation.
Throws
Overrides
|
public
boolean
|
#
exists( string $path, string $name )
Returns if a given file or folder exists in a folder.
Returns if a given file or folder exists in a folder.
Parameters
- $path
- The path to the folder.
- $name
- The file or folder name.
Returns
boolean True if it exists, false otherwise.
Overrides
|
public
array
|
#
listFolders( string $path = '', mixed $filter = null, boolean $dotfolders = true )
Returns a sorted list of folders in the specified directory.
Returns a sorted list of folders in the 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?
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 of the original file.
- $name
- The name of the original file.
- $dest
- The name of the destination directory.
- $autocreate
- <p>Auto-create the directory if it doesn't
exist?</p>
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 of the original file.
- $name
- The name of the original file.
- $dest
- The destination file name.
- $autocreate
- <p>Auto-create the directory if it doesn't
exist?</p>
Throws
Overrides
|
public
string
|
#
getCurrentDirectory( )
Returns the current working directory on the SSH2 server.
Returns the current working directory on the SSH2 server.
Returns
string The current working directory.
Throws
Overrides
|