VFS
[ class tree: VFS ] [ index: VFS ] [ all elements ]

Class: VFS

Source Location: /VFS-0.3.0/lib/VFS.php

Class Overview


VFS API for abstracted file storage and access.


Author(s):

Methods


Child classes:

VFS_kolab
VFS implementation for a Kolab IMAP server.
VFS_smb
Stateless VFS implementation for a SMB server, based on smbclient.
VFS_ftp
VFS implementation for an FTP server.
VFS_file
VFS implementation for a standard filesystem.
VFS_ssh2
VFS implementation for an SSH2 server.
VFS_sql
VFS implementation for PHP's PEAR database abstraction layer.
VFS_horde
VFS implementation for the Horde Application Framework.

Inherited Variables

Inherited Methods


Class Details

[line 25]
VFS API for abstracted file storage and access.

$Horde: framework/VFS/lib/VFS.php,v 1.1.2.8 2009/01/06 15:23:46 jan Exp $

Copyright 2002-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.



[ Top ]


Method Detail

VFS (Constructor)   [line 80]

VFS VFS( [array $params = array()])

Constructor.

Parameters:

array   $params   —  A hash containing connection parameters.

[ Top ]

autocreatePath   [line 540]

void autocreatePath( string $path)

Automatically creates any necessary parent directories in the specified $path.

Parameters:

string   $path   —  The VFS path to autocreate.

[ Top ]

changePermissions   [line 741]

mixed changePermissions( string $path, string $name, string $permission)

Changes permissions for an item on the VFS.
  • Return: True on success or a PEAR_Error object on failure.
  • Abstract:

Overridden in child classes as:

VFS_ftp::changePermissions()
Changes permissions for an item on the VFS.
VFS_file::changePermissions()
Changes permissions for an item in the VFS.
VFS_ssh2::changePermissions()
Changes permissions for an item on the VFS.
VFS_musql::changePermissions()
Changes permissions for an Item on the VFS.

Parameters:

string   $path   —  The parent folder of the item.
string   $name   —  The name of the item.
string   $permission   —  The permission to set.

[ Top ]

checkCredentials   [line 101]

mixed checkCredentials( )

Checks the credentials that we have by calling _connect(), to see if there is a valid login.
  • Return: True on success, PEAR_Error describing the problem if the credentials are invalid.

[ Top ]

copy   [line 405]

mixed copy( string $path, string $name, string $dest, [boolean $autocreate = false])

Copies a file through the backend.
  • Return: True on success or a PEAR_Error object on failure.

Overridden in child classes as:

VFS_smb::copy()
Copies a file through the backend.
VFS_ftp::copy()
Copies a file through the backend.
VFS_file::copy()
Copies a file through the backend.
VFS_sql_file::copy()
Copies a file through the backend.
VFS_ssh2::copy()
Copies a file through the backend.
VFS_horde::copy()
Copies a file through the backend.

Parameters:

string   $path   —  The path of the original file.
string   $name   —  The name of the original file.
string   $dest   —  The name of the destination directory.
boolean   $autocreate   —  Automatically create directories?

[ Top ]

createFolder   [line 529]

mixed createFolder( string $path, string $name)

Creates a folder in the VFS.
  • Return: True on success or a PEAR_Error object on failure.
  • Abstract:

Overridden in child classes as:

VFS_kolab::createFolder()
Creates a folder on the VFS.
VFS_smb::createFolder()
Creates a folder on the VFS.
VFS_ftp::createFolder()
Creates a folder on the VFS.
VFS_file::createFolder()
Creates a folder on the VFS.
VFS_sql_file::createFolder()
Creates a folder on the VFS.
VFS_ssh2::createFolder()
Creates a folder on the VFS.
VFS_sql::createFolder()
Creates a folder on the VFS.
VFS_musql::createFolder()
Creates a folder on the VFS.

Parameters:

string   $path   —  The parent folder.
string   $name   —  The name of the new folder.

[ Top ]

delete   [line 464]

void delete( $path, $name)

Alias to deleteFile()

Parameters:

   $path   — 
   $name   — 

[ Top ]

deleteFile   [line 479]

mixed deleteFile( string $path, string $name)

Deletes a file from the VFS.
  • Return: True on success or a PEAR_Error object on failure.
  • Abstract:

Overridden in child classes as:

VFS_kolab::deleteFile()
Deletes a file from the VFS.
VFS_smb::deleteFile()
Deletes a file from the VFS.
VFS_ftp::deleteFile()
Deletes a file from the VFS.
VFS_file::deleteFile()
Delete a file from the VFS.
VFS_sql_file::deleteFile()
Delete a file from the VFS.
VFS_ssh2::deleteFile()
Deletes a file from the VFS.
VFS_sql::deleteFile()
Delete a file from the VFS.
VFS_musql::deleteFile()
Deletes a file from the VFS.
VFS_horde::deleteFile()
Deletes a file from the VFS.

Parameters:

string   $path   —  The path to delete the file from.
string   $name   —  The filename to delete.

[ Top ]

deleteFolder   [line 590]

mixed deleteFolder( string $path, string $name, [boolean $recursive = false])

Deletes a folder from the VFS.
  • Return: True on success or a PEAR_Error object on failure.
  • Abstract:

Overridden in child classes as:

VFS_kolab::deleteFolder()
Deletes a folder from the VFS.
VFS_smb::deleteFolder()
Deletes a folder from the VFS.
VFS_ftp::deleteFolder()
Deletes a folder from the VFS.
VFS_file::deleteFolder()
Delete a folder from the VFS.
VFS_sql_file::deleteFolder()
Delete a folder from the VFS.
VFS_ssh2::deleteFolder()
Deletes a folder from the VFS.
VFS_sql::deleteFolder()
Delete a folder from the VFS.
VFS_musql::deleteFolder()
Deletes a folder from the VFS.

Parameters:

string   $path   —  The parent folder.
string   $name   —  The name of the folder to delete.
boolean   $recursive   —  Force a recursive delete?

[ Top ]

emptyFolder   [line 603]

mixed emptyFolder( string $path)

Recursively remove all files and subfolders from the given folder.
  • Return: True on success or a PEAR_Error object on failure.

Overridden in child classes as:

VFS_kolab::emptyFolder()
Recursively remove all files and subfolders from the given folder.

Parameters:

string   $path   —  The path of the folder to empty.

[ Top ]

exists   [line 509]

boolean exists( string $path, string $name)

Returns if a given file or folder exists in a folder.
  • Return: True if it exists, false otherwise.

Overridden in child classes as:

VFS_file::exists()
Returns if a given file or folder exists in a folder.

Parameters:

string   $path   —  The path to the folder.
string   $name   —  The file or folder name.

[ Top ]

factory   [line 1056]

VFS &factory( mixed $driver, [array $params = array()])

Attempts to return a concrete VFS instance based on $driver.
  • Return: The newly created concrete VFS instance, or a PEAR_Error on failure.

Parameters:

mixed   $driver   —  The type of concrete VFS subclass to return. This is based on the storage driver ($driver). The code is dynamically included.
array   $params   —  A hash containing any additional configuration or connection parameters a subclass might need.

[ Top ]

getCurrentDirectory   [line 682]

string getCurrentDirectory( )

Returns the current working directory of the VFS backend.
  • Return: The current working directory.

Overridden in child classes as:

VFS_ftp::getCurrentDirectory()
Returns the current working directory on the FTP server.
VFS_ssh2::getCurrentDirectory()
Returns the current working directory on the SSH2 server.

[ Top ]

getFolderSize   [line 207]

integer getFolderSize( [string $path = null], [string $name = null])

Returns the size of a folder
  • Return: The size of the folder, in bytes, or PEAR_Error on failure.
  • Since: Horde 3.1

Overridden in child classes as:

VFS_sql::getFolderSize()
Returns the size of a file.

Parameters:

string   $path   —  The path to the folder.
string   $name   —  The name of the folder.

[ Top ]

getModifiablePermissions   [line 779]

array getModifiablePermissions( )

Returns an array specifying what permissions are changeable for this VFS implementation.
  • Return: Changeable permisions.

[ Top ]

getParam   [line 125]

mixed getParam( string $name)

Returns configuration parameters.
  • Return: The parameter value or null if it doesn't exist.

Parameters:

string   $name   —  The parameter to return.

[ Top ]

getQuota   [line 888]

mixed getQuota( )

Get quota information (used/allocated), in bytes.
  • Return: An associative array. 'limit' = Maximum quota allowed 'usage' = Currently used portion of quota (in bytes) Returns PEAR_Error on failure.
  • Since: Horde 3.1

[ Top ]

getRequiredCredentials   [line 768]

array getRequiredCredentials( )

Returns the list of additional credentials required, if any.
  • Return: Credential list.

[ Top ]

getVFSSize   [line 831]

integer getVFSSize( )

Returns the size of the VFS item.
  • Return: The size, in bytes, of the VFS item.
  • Since: Horde 3.1

[ Top ]

isFolder   [line 573]

boolean isFolder( string $path, string $name)

Checks if a given item is a folder.
  • Return: True if it is a folder, false otherwise.

Overridden in child classes as:

VFS_smb::isFolder()
Checks if a given pathname is a folder.
VFS_ftp::isFolder()
Checks if a given item is a folder.
VFS_file::isFolder()
Check if a given pathname is a folder.
VFS_ssh2::isFolder()
Checks if a given item is a folder.
VFS_sql::isFolder()
VFS_sql override of isFolder() to check for root folder.

Parameters:

string   $path   —  The parent folder.
string   $name   —  The item name.

[ Top ]

listFolder   [line 642]

array listFolder( string $path, [mixed $filter = null], [boolean $dotfiles = true], [boolean $dironly = false], [boolean $recursive = false])

Returns a file list of the directory passed in.
  • Return: File list on success or PEAR_Error on failure.

Overridden in child classes as:

VFS_smb::listFolder()
Returns an unsorted file list.

Parameters:

string   $path   —  The path of the directory.
mixed   $filter   —  String/hash to filter file/dirname on.
boolean   $dotfiles   —  Show dotfiles?
boolean   $dironly   —  Show only directories?
boolean   $recursive   —  Return all directory levels recursively?

[ Top ]

listFolders   [line 758]

mixed listFolders( [string $path = ''], [mixed $filter = null], [boolean $dotfolders = true])

Returns a sorted list of folders in the specified directory.
  • Return: Folder list on success or a PEAR_Error object on failure.
  • Abstract:

Overridden in child classes as:

VFS_kolab::listFolders()
Returns a sorted list of folders in the specified directory.
VFS_smb::listFolders()
Returns a sorted list of folders in specified directory.
VFS_ftp::listFolders()
Returns a sorted list of folders in the specified directory.
VFS_file::listFolders()
Returns a sorted list of folders in specified directory.
VFS_sql_file::listFolders()
Returns a sorted list of folders in specified directory.
VFS_ssh2::listFolders()
Returns a sorted list of folders in the specified directory.
VFS_sql::listFolders()
Returns a sorted list of folders in specified directory.
VFS_horde::listFolders()
Returns a sorted list of folders in the specified directory.

Parameters:

string   $path   —  The path of the directory to get the directory list for.
mixed   $filter   —  Hash of items to filter based on folderlist.
boolean   $dotfolders   —  Include dotfolders?

[ Top ]

log   [line 137]

void log( mixed $message, [integer $priority = PEAR_LOG_ERR])

Logs a message if a PEAR Log object is available, and the message's priority is lower than or equal to the configured log level.

Parameters:

mixed   $message   —  The message to be logged.
integer   $priority   —  The message's priority.

[ Top ]

move   [line 387]

mixed move( string $path, string $name, string $dest, [boolean $autocreate = false])

Moves a file through the backend.
  • Return: True on success or a PEAR_Error object on failure.

Overridden in child classes as:

VFS_smb::move()
Moves a file through the backend.
VFS_ftp::move()
Moves a file through the backend.
VFS_file::move()
Moves a file in the database and the file system.
VFS_sql_file::move()
Moves a file in the database and the file system.
VFS_ssh2::move()
Moves a file through the backend.
VFS_horde::move()
Moves a file through the backend.

Parameters:

string   $path   —  The path of the original file.
string   $name   —  The name of the original file.
string   $dest   —  The destination file name.
boolean   $autocreate   —  Automatically create directories?

[ Top ]

read   [line 237]

string read( string $path, string $name)

Retrieves a file from the VFS.
  • Return: The file data.
  • Abstract:

Overridden in child classes as:

VFS_kolab::read()
Retrieves a file from the VFS.
VFS_smb::read()
Retrieves a file from the VFS.
VFS_ftp::read()
Retrieves a file from the VFS.
VFS_file::read()
Retrieve a file from the VFS.
VFS_ssh2::read()
Retrieves a file from the VFS.
VFS_sql::read()
Retrieve a file from the VFS.
VFS_horde::read()
Retrieves a file from the VFS.

Parameters:

string   $path   —  The pathname to the file.
string   $name   —  The filename to retrieve.

[ Top ]

readByteRange   [line 337]

string readByteRange( string $path, string $name, &$offset, [integer $length = -1], &$remaining, integer $offset, integer $remaining)

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.
  • Return: The file data.
  • Abstract:

Overridden in child classes as:

VFS_file::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.
VFS_sql::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.

Parameters:

string   $path   —  The pathname to the file.
string   $name   —  The filename to retrieve.
integer   $offset   —  The offset of the part. (The new offset will be stored in here).
integer   $length   —  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.
integer   $remaining   —  The bytes that are left, after the part that is retrieved.
   &$offset   — 
   &$remaining   — 

[ Top ]

readFile   [line 254]

string readFile( string $path, string $name)

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 <em>cannot</em> be modified! The behavior if you do modify it is undefined. It will be removed at the end of the request.

  • Return: A local filename.

Overridden in child classes as:

VFS_smb::readFile()
Retrieves a file from the VFS as an on-disk local file.
VFS_ftp::readFile()
Retrieves a file from the VFS as an on-disk local file.
VFS_file::readFile()
Retrieves a file from the VFS as an on-disk local file.
VFS_ssh2::readFile()
Retrieves a file from the VFS as an on-disk local file.

Parameters:

string   $path   —  The pathname to the file.
string   $name   —  The filename to retrieve.

[ Top ]

rename   [line 496]

mixed rename( string $oldpath, string $oldname, string $newpath, string $newname)

Renames a file in the VFS.
  • Return: True on success or a PEAR_Error object on failure.
  • Abstract:

Overridden in child classes as:

VFS_smb::rename()
Renames a file in the VFS.
VFS_ftp::rename()
Renames a file in the VFS.
VFS_file::rename()
Rename a file or folder in the VFS.
VFS_sql_file::rename()
Rename a file or folder in the VFS.
VFS_ssh2::rename()
Renames a file in the VFS.
VFS_sql::rename()
Rename a file or folder in the VFS.
VFS_musql::rename()
Renames a file or folder in the VFS.
VFS_horde::rename()
Renames a file in the VFS.

Parameters:

string   $oldpath   —  The old path to the file.
string   $oldname   —  The old filename.
string   $newpath   —  The new path of the file.
string   $newname   —  The new filename.

[ Top ]

setLogger   [line 169]

void setLogger( Log &$logger, [ $logLevel = null])

Sets the PEAR Log object used to log informational or error messages.

Parameters:

Log   &$logger   —  The Log object to use.
   $logLevel   — 

[ Top ]

setParams   [line 111]

void setParams( [array $params = array()])

Sets configuration parameters.

Parameters:

array   $params   —  An associative array with parameter names as keys.

[ Top ]

setQuota   [line 847]

void setQuota( integer $quota, [integer $metric = VFS_QUOTA_METRIC_BYTE])

Sets the VFS quota limit.
  • Since: Horde 3.1

Parameters:

integer   $quota   —  The limit to apply.
integer   $metric   —  The metric to multiply the quota into.

[ Top ]

setQuotaRoot   [line 873]

void setQuotaRoot( string $dir)

Sets the VFS quota root.
  • Since: Horde 3.1

Parameters:

string   $dir   —  The root directory for the quota determination.

[ Top ]

singleton   [line 1091]

VFS &singleton( mixed $driver, [array $params = array()])

Attempts to return a reference to a concrete VFS instance based on $driver. It will only create a new instance if no VFS instance with the same parameters currently exists.

This should be used if multiple types of file backends (and, thus, multiple VFS instances) are required.

This method must be invoked as: $var = &VFS::singleton()

  • Return: The concrete VFS reference, or a PEAR_Error on failure.

Parameters:

mixed   $driver   —  The type of concrete VFS subclass to return. This is based on the storage driver ($driver). The code is dynamically included.
array   $params   —  A hash containing any additional configuration or connection parameters a subclass might need.

[ Top ]

size   [line 191]

integer size( string $path, string $name)

Retrieves the size of a file from the VFS.
  • Return: The file size.
  • Abstract:

Overridden in child classes as:

VFS_ftp::size()
Returns the size of a file.
VFS_file::size()
Retrieves the filesize from the VFS.
VFS_ssh2::size()
Returns the size of a file.
VFS_sql::size()
Retrieves the filesize from the VFS.
VFS_horde::size()
Retrieves the size of a file from the VFS.

Parameters:

string   $path   —  The pathname to the file.
string   $name   —  The filename to retrieve.

[ Top ]

strlen   [line 810]

string strlen( string $string, [string $charset = null])

Returns the character (not byte) length of a string.
  • Return: The string's length.

Parameters:

string   $string   —  The string to return the length of.
string   $charset   —  The charset to use when calculating the string's length.

[ Top ]

strtolower   [line 792]

string strtolower( string $string)

Converts a string to all lowercase characters ignoring the current locale.
  • Return: The string with lowercase characters

Parameters:

string   $string   —  The string to be lowercased

[ Top ]

write   [line 355]

mixed write( string $path, string $name, string $tmpFile, [boolean $autocreate = false])

Stores a file in the VFS.
  • Return: True on success or a PEAR_Error object on failure.
  • Abstract:

Overridden in child classes as:

VFS_kolab::write()
Stores a file in the VFS.
VFS_smb::write()
Stores a file in the VFS.
VFS_ftp::write()
Stores a file in the VFS.
VFS_file::write()
Store a file in the VFS, with the data copied from a temporary file.
VFS_sql_file::write()
Store a file in the VFS, with the data copied from a temporary file.
VFS_ssh2::write()
Stores a file in the VFS.
VFS_sql::write()
Stores a file in the VFS.
VFS_horde::write()
Stores a file in the VFS.

Parameters:

string   $path   —  The path to store the file in.
string   $name   —  The filename to use.
string   $tmpFile   —  The temporary file containing the data to be stored.
boolean   $autocreate   —  Automatically create directories?

[ Top ]

writeData   [line 372]

mixed writeData( string $path, string $name, string $data, [boolean $autocreate = false])

Stores a file in the VFS from raw data.
  • Return: True on success or a PEAR_Error object on failure.
  • Abstract:

Overridden in child classes as:

VFS_smb::writeData()
Stores a file in the VFS from raw data.
VFS_ftp::writeData()
Stores a file in the VFS from raw data.
VFS_file::writeData()
Store a file in the VFS from raw data.
VFS_sql_file::writeData()
Store a file in the VFS from raw data.
VFS_ssh2::writeData()
Stores a file in the VFS from raw data.
VFS_sql::writeData()
Store a file in the VFS from raw data.
VFS_musql::writeData()
Stores a file in the VFS from raw data.
VFS_horde::writeData()
Stores a file in the VFS from raw data.

Parameters:

string   $path   —  The path to store the file in.
string   $name   —  The filename to use.
string   $data   —  The file data.
boolean   $autocreate   —  Automatically create directories?

[ Top ]

_copyRecursive   [line 441]

void _copyRecursive( string $path, string $name, string $dest)

Recursively copies a directory through the backend.
  • Access: protected

Parameters:

string   $path   —  The path of the original file.
string   $name   —  The name of the original file.
string   $dest   —  The name of the destination directory.

[ Top ]

_getPath   [line 1031]

mixed _getPath( string $path, string $name)

Returns the full path of an item.
  • Return: Full path when $path isset and just $name when not set.
  • Access: protected

Parameters:

string   $path   —  The path of directory of the item.
string   $name   —  The name of the item.

[ Top ]

_getTempDir   [line 910]

string _getTempDir( )

Determines the location of the system temporary directory.
  • Return: A directory name which can be used for temp files. Returns false if one could not be found.
  • Access: protected

[ Top ]

_getTempFile   [line 945]

string _getTempFile( )

Creates a temporary file.
  • Return: Returns the full path-name to the temporary file or false if a temporary file could not be created.
  • Access: protected

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:34:57 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.