Constructor.
VFS
VFS
([array $params = array()])
-
array
$params: A hash containing connection parameters.
Automatically creates any necessary parent directories in the specified $path.
void
autocreatePath
(string $path)
-
string
$path: The VFS path to autocreate.
Changes permissions for an item on the VFS.
mixed
changePermissions
(string $path, string $name, string $permission)
-
string
$path: The parent folder of the item.
-
string
$name: The name of the item.
-
string
$permission: The permission to set.
Redefined in descendants as:
Checks the credentials that we have by calling _connect(), to see if there is a valid login.
mixed
checkCredentials
()
Copies a file through the backend.
mixed
copy
(string $path, string $name, string $dest, [boolean $autocreate = false])
-
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?
Redefined in descendants as:
Creates a folder in the VFS.
mixed
createFolder
(string $path, string $name)
-
string
$path: The parent folder.
-
string
$name: The name of the new folder.
Redefined in descendants as:
Alias to deleteFile()
void
delete
( $path, $name)
Deletes a file from the VFS.
mixed
deleteFile
(string $path, string $name)
-
string
$path: The path to delete the file from.
-
string
$name: The filename to delete.
Redefined in descendants as:
Deletes a folder from the VFS.
mixed
deleteFolder
(string $path, string $name, [boolean $recursive = false])
-
string
$path: The parent folder.
-
string
$name: The name of the folder to delete.
-
boolean
$recursive: Force a recursive delete?
Redefined in descendants as:
Recursively remove all files and subfolders from the given folder.
mixed
emptyFolder
(string $path)
-
string
$path: The path of the folder to empty.
Redefined in descendants as:
Returns if a given file or folder exists in a folder.
boolean
exists
(string $path, string $name)
-
string
$path: The path to the folder.
-
string
$name: The file or folder name.
Redefined in descendants as:
Attempts to return a concrete VFS instance based on $driver.
VFS
&factory
(
mixed $driver, [
array $params =
array()])
-
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.
Returns the current working directory of the VFS backend.
string
getCurrentDirectory
()
Redefined in descendants as:
Returns the size of a folder
integer
getFolderSize
([string $path = null], [string $name = null])
-
string
$path: The path to the folder.
-
string
$name: The name of the folder.
Redefined in descendants as:
Returns an array specifying what permissions are changeable for this VFS implementation.
array
getModifiablePermissions
()
Returns configuration parameters.
mixed
getParam
(string $name)
-
string
$name: The parameter to return.
Get quota information (used/allocated), in bytes.
mixed
getQuota
()
Returns the list of additional credentials required, if any.
array
getRequiredCredentials
()
Returns the size of the VFS item.
integer
getVFSSize
()
Checks if a given item is a folder.
boolean
isFolder
(string $path, string $name)
-
string
$path: The parent folder.
-
string
$name: The item name.
Redefined in descendants as:
Returns a file list of the directory passed in.
array
listFolder
(string $path, [mixed $filter = null], [boolean $dotfiles = true], [boolean $dironly = false], [boolean $recursive = false])
-
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?
Redefined in descendants as:
Returns a sorted list of folders in the specified directory.
mixed
listFolders
([string $path = ''], [mixed $filter = null], [boolean $dotfolders = true])
-
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?
Redefined in descendants as:
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.
void
log
(mixed $message, [integer $priority = PEAR_LOG_ERR])
-
mixed
$message: The message to be logged.
-
integer
$priority: The message's priority.
Moves a file through the backend.
mixed
move
(string $path, string $name, string $dest, [boolean $autocreate = false])
-
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?
Redefined in descendants as:
Retrieves a file from the VFS.
string
read
(string $path, string $name)
-
string
$path: The pathname to the file.
-
string
$name: The filename to retrieve.
Redefined in descendants as:
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.
string
readByteRange
(string $path, string $name, &$offset, [integer $length = -1], &$remaining, integer $offset, integer $remaining)
-
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
Redefined in descendants 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.
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.
string
readFile
(string $path, string $name)
-
string
$path: The pathname to the file.
-
string
$name: The filename to retrieve.
Redefined in descendants as:
Renames a file in the VFS.
mixed
rename
(string $oldpath, string $oldname, string $newpath, string $newname)
-
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.
Redefined in descendants as:
Sets the PEAR Log object used to log informational or error messages.
void
setLogger
(Log &$logger, [ $logLevel = null])
-
Log
&$logger: The Log object to use.
-
$logLevel
Sets configuration parameters.
void
setParams
([array $params = array()])
-
array
$params: An associative array with parameter names as keys.
Sets the VFS quota limit.
void
setQuota
(integer $quota, [integer $metric = VFS_QUOTA_METRIC_BYTE])
-
integer
$quota: The limit to apply.
-
integer
$metric: The metric to multiply the quota into.
Sets the VFS quota root.
void
setQuotaRoot
(string $dir)
-
string
$dir: The root directory for the quota determination.
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()
VFS
&singleton
(
mixed $driver, [
array $params =
array()])
-
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.
Retrieves the size of a file from the VFS.
integer
size
(string $path, string $name)
-
string
$path: The pathname to the file.
-
string
$name: The filename to retrieve.
Redefined in descendants as:
Returns the character (not byte) length of a string.
string
strlen
(string $string, [string $charset = null])
-
string
$string: The string to return the length of.
-
string
$charset: The charset to use when calculating the string's length.
Converts a string to all lowercase characters ignoring the current locale.
string
strtolower
(string $string)
-
string
$string: The string to be lowercased
Stores a file in the VFS.
mixed
write
(string $path, string $name, string $tmpFile, [boolean $autocreate = false])
-
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?
Redefined in descendants as:
Stores a file in the VFS from raw data.
mixed
writeData
(string $path, string $name, string $data, [boolean $autocreate = false])
-
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?
Redefined in descendants as:
Recursively copies a directory through the backend.
void
_copyRecursive
(string $path, string $name, string $dest)
-
string
$path: The path of the original file.
-
string
$name: The name of the original file.
-
string
$dest: The name of the destination directory.
Returns the full path of an item.
mixed
_getPath
(string $path, string $name)
-
string
$path: The path of directory of the item.
-
string
$name: The name of the item.
Determines the location of the system temporary directory.
string
_getTempDir
()
Creates a temporary file.
string
_getTempFile
()
Returns an an unsorted file list of the specified directory.
array
_listFolder
(string $path, [mixed $filter = null], [boolean $dotfiles = true], [boolean $dironly = false])
-
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?
Redefined in descendants as: