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

Class: VFS

Source Location: /VFS-0.0.5/VFS.php

Class Overview


VFS API for abstracted file storage and access.


Author(s):

Methods


Child classes:

VFS_sql_file
VFS:: implementation using PHP's PEAR database abstraction layer and local file system for file storage.
VFS_ftp
VFS implementation for an FTP server.
VFS_file
VFS implementation for a standard filesystem.
VFS_sql
VFS implementation for PHP's PEAR database abstraction layer.

Inherited Variables

Inherited Methods


Class Details

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

$Horde: framework/VFS/VFS.php,v 1.72 2005/01/30 23:53:51 jan Exp $

Copyright 2002-2005 Chuck Hagenbuch <chuck@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 70]

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

Constructor.
  • Access: public

Parameters:

array   $params   —  A hash containing connection parameters.

[ Top ]

autocreatePath   [line 336]

void autocreatePath( string $path)

Automatically creates any necessary parent directories in the specified $path.
  • Access: public

Parameters:

string   $path   —  The VFS path to autocreate.

[ Top ]

changePermissions   [line 542]

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:
  • Access: public

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_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 87]

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.
  • Access: public

[ Top ]

copy   [line 253]

mixed copy( string $path, string $name, string $dest)

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

Overridden in child classes as:

VFS_sql_file::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.

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 ]

createFolder   [line 323]

mixed createFolder( string $path, string $name)

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

Overridden in child classes as:

VFS_sql_file::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::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 ]

deleteFile   [line 269]

mixed deleteFile( string $path, string $name)

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

Overridden in child classes as:

VFS_sql_file::deleteFile()
Delete 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::deleteFile()
Delete a file from the VFS.
VFS_musql::deleteFile()
Delete a file from the VFS.

Parameters:

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

[ Top ]

deleteFolder   [line 386]

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:
  • Access: public

Overridden in child classes as:

VFS_sql_file::deleteFolder()
Delete 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::deleteFolder()
Delete a folder from the VFS.
VFS_musql::deleteFolder()
Delete a file 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 400]

mixed emptyFolder( string $path)

Removes recursively all files and subfolders from the given folder.
  • Return: True on success or a PEAR_Error object on failure.
  • Access: public

Parameters:

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

[ Top ]

exists   [line 302]

boolean exists( string $path, string $name)

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

Parameters:

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

[ Top ]

factory   [line 648]

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.
  • Access: public

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 482]

string getCurrentDirectory( )

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

Overridden in child classes as:

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

[ Top ]

getModifiablePermissions   [line 585]

array getModifiablePermissions( )

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

[ Top ]

getParam   [line 115]

mixed getParam( string $name)

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

Parameters:

string   $name   —  The parameter to return.

[ Top ]

getRequiredCredentials   [line 572]

array getRequiredCredentials( )

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

[ Top ]

isFolder   [line 368]

boolean isFolder( string $path, string $name)

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

Overridden in child classes as:

VFS_ftp::isFolder()
Checks if a given item is a folder.
VFS_file::isFolder()
Check if a given pathname is a folder.

Parameters:

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

[ Top ]

listFolder   [line 439]

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.
  • Access: public

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 560]

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:
  • Access: public

Overridden in child classes as:

VFS_sql_file::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::listFolders()
Returns a sorted list of folders in 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 127]

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 236]

mixed move( string $path, string $name, string $dest)

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

Overridden in child classes as:

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

Parameters:

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

[ Top ]

read   [line 182]

string read( string $path, string $name)

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

Overridden in child classes as:

VFS_sql_file::read()
Retrieve a file from the VFS.
VFS_ftp::read()
Retrieves a file from the VFS.
VFS_file::read()
Retrieve a file from the VFS.
VFS_sql::read()
Retrieve a file from the VFS.

Parameters:

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

[ Top ]

rename   [line 287]

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:
  • Access: public

Overridden in child classes as:

VFS_sql_file::rename()
Rename a file or folder 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::rename()
Rename a file or folder in the VFS.
VFS_musql::rename()
Rename a file or folder 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 159]

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 99]

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

Sets configuration parameters.
  • Access: public

Parameters:

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

[ Top ]

singleton   [line 679]

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.
  • Access: public

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 ]

strlen   [line 620]

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

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

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 600]

string strtolower( string $string)

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

Parameters:

string   $string   —  The string to be lowercased

[ Top ]

write   [line 201]

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:
  • Access: public

Overridden in child classes as:

VFS_sql_file::write()
Store a file in the VFS, with the data copied from a temporary file.
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::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 219]

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:
  • Access: public

Overridden in child classes as:

VFS_sql_file::writeData()
Store 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::writeData()
Store a file in the VFS from raw data.
VFS_musql::writeData()
Store 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 ]

_listFolder   [line 469]

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

Returns an an unsorted file list of the specified directory.
  • Return: File list on success or PEAR_Error on failure.
  • Abstract:
  • Access: public

Overridden in child classes as:

VFS_sql_file::_listFolder()
Return a list of the contents of a folder.
VFS_ftp::_listFolder()
Returns an an unsorted file list of the specified directory.
VFS_file::_listFolder()
Return a list of the contents of a folder.
VFS_sql::_listFolder()
Return a list of the contents of a folder.

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?

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:31:27 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.