Class VFS_file

Description

VFS implementation for a standard filesystem.

Required parameters:

   'vfsroot'  The root path

Note: The user that your webserver runs as (commonly 'nobody', 'apache', or 'www-data') MUST have read/write permission to the directory you specify as the 'vfsroot'.

$Horde: framework/VFS/lib/VFS/file.php,v 1.1.2.7 2010/06/29 04:51:13 slusarz 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.

  • author: Chuck Hagenbuch

Located in /VFS/lib/VFS/file.php (line 22)

VFS
   |
   --VFS_file
Direct descendents
Class Description
 class VFS_sql_file VFS:: implementation using PHP's PEAR database abstraction layer and local file system for file storage.
Variable Summary
Method Summary
 VFS_file VFS_file ([array $params = array()])
 mixed changePermissions (string $path, string $name, integer $permission)
 mixed copy (string $path, string $name, string $dest, [boolean $autocreate = false])
 mixed createFolder (string $path, string $name)
 mixed deleteFile (string $path, string $name)
 mixed deleteFolder (string $path, string $name, [boolean $recursive = false])
 boolean exists (string $path, string $name)
 boolean isFolder (string $path, string $name)
 mixed listFolders ([string $path = ''], [mixed $filter = null], [boolean $dotfolders = true])
 mixed move (string $path, string $name, string $dest, [boolean $autocreate = false])
 string read (string $path, string $name)
 string readByteRange (string $path, string $name,  &$offset, [integer $length = -1],  &$remaining, integer $offset, integer $remaining)
 string readFile (string $path, string $name)
 resource readStream (string $path, string $name)
 mixed rename (string $oldpath, string $oldname, string $newpath, string $newname)
 integer size (string $path, string $name)
 mixed write (string $path, string $name, string $tmpFile, [boolean $autocreate = true])
 mixed writeData (string $path, string $name, string $data, [boolean $autocreate = true])
 array _listFolder (string $path, [mixed $filter = null], [boolean $dotfiles = true], [boolean $dironly = false])
Variables
array $_permissions = array(
'owner' => array('read' => true, 'write' => true, 'execute' => true),'group'=>array('read'=>true,'write'=>true,'execute'=>true),'all'=>array('read'=>true,'write'=>true,'execute'=>true))
(line 30)

List of permissions and if they can be changed in this VFS backend.


Redefinition of:
VFS::$_permissions
List of permissions and if they can be changed in this VFS backend.

Inherited Variables

Inherited from VFS

VFS::$_credentials
VFS::$_logger
VFS::$_logLevel
VFS::$_params
VFS::$_vfsSize
Methods
Constructor VFS_file (line 41)

Constructs a new Filesystem based VFS object.

VFS_file VFS_file ([array $params = array()])
  • array $params: A hash containing connection parameters.
changePermissions (line 456)

Changes permissions for an item in the VFS.

  • return: True on success or a PEAR_Error object on failure.
mixed changePermissions (string $path, string $name, integer $permission)
  • string $path: The path of directory of the item.
  • string $name: The name of the item.
  • integer $permission: The octal value of the new permission.

Redefinition of:
VFS::changePermissions()
Changes permissions for an item on the VFS.
copy (line 268)

Copies a file through the backend.

  • return: True on success or a PEAR_Error object on failure.
mixed copy (string $path, string $name, string $dest, [boolean $autocreate = false])
  • string $path: The path to store the file in.
  • string $name: The filename to use.
  • string $dest: The destination of the file.
  • boolean $autocreate: Automatically create directories?

Redefinition of:
VFS::copy()
Copies a file through the backend.

Redefined in descendants as:
createFolder (line 425)

Creates a folder on the VFS.

  • return: True on success or a PEAR_Error object on failure.
mixed createFolder (string $path, string $name)
  • string $path: The path to create the folder in.
  • string $name: The foldername to use.

Redefinition of:
VFS::createFolder()
Creates a folder in the VFS.

Redefined in descendants as:
deleteFile (line 369)

Delete a file from the VFS.

  • return: True on success or a PEAR_Error object on failure.
mixed deleteFile (string $path, string $name)
  • string $path: The path to store the file in.
  • string $name: The filename to use.

Redefinition of:
VFS::deleteFile()
Deletes a file from the VFS.

Redefined in descendants as:
deleteFolder (line 392)

Delete a folder from the VFS.

  • return: True on success or a PEAR_Error object on failure.
mixed deleteFolder (string $path, string $name, [boolean $recursive = false])
  • string $path: The path to delete the folder from.
  • string $name: The foldername to use.
  • boolean $recursive: Force a recursive delete?

Redefinition of:
VFS::deleteFolder()
Deletes a folder from the VFS.

Redefined in descendants as:
exists (line 706)

Returns if a given file or folder exists in a folder.

  • return: True if it exists, false otherwise.
boolean exists (string $path, string $name)
  • string $path: The path to the folder.
  • string $name: The file or folder name.

Redefinition of:
VFS::exists()
Returns if a given file or folder exists in a folder.
isFolder (line 442)

Check if a given pathname is a folder.

  • return: True if it is a folder, false otherwise.
boolean isFolder (string $path, string $name)
  • string $path: The path to the folder.
  • string $name: The file/folder name.

Redefinition of:
VFS::isFolder()
Checks if a given item is a folder.
listFolders (line 604)

Returns a sorted list of folders in specified directory.

  • return: Folder list on success or a PEAR_Error object on failure.
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?

Redefinition of:
VFS::listFolders()
Returns a sorted list of folders in the specified directory.

Redefined in descendants as:
move (line 227)

Moves a file in the database and the file system.

  • return: True on success or a PEAR_Error object on failure.
mixed move (string $path, string $name, string $dest, [boolean $autocreate = false])
  • string $path: The path to store the file in.
  • string $name: The filename to use.
  • string $dest: The destination of the file.
  • boolean $autocreate: Automatically create directories?

Redefinition of:
VFS::move()
Moves a file through the backend.

Redefined in descendants as:
read (line 78)

Retrieve a file from the VFS.

  • return: The file data.
string read (string $path, string $name)
  • string $path: The pathname to the file.
  • string $name: The filename to retrieve.

Redefinition of:
VFS::read()
Retrieves a file from the VFS.
readByteRange (line 145)

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

Redefinition of:
VFS::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.
readFile (line 100)

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.
string readFile (string $path, string $name)
  • string $path: The pathname to the file.
  • string $name: The filename to retrieve.

Redefinition of:
VFS::readFile()
Retrieves a file from the VFS as an on-disk local file.
readStream (line 113)

Open a read-only stream to a file in the VFS.

  • return: The stream.
resource readStream (string $path, string $name)
  • string $path: The pathname to the file.
  • string $name: The filename to retrieve.
rename (line 682)

Rename a file or folder in the VFS.

  • return: True on success or a PEAR_Error object on failure.
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.

Redefinition of:
VFS::rename()
Renames a file in the VFS.

Redefined in descendants as:
size (line 61)

Retrieves the filesize from the VFS.

  • return: The file size.
integer size (string $path, string $name)
  • string $path: The pathname to the file.
  • string $name: The filename to retrieve.

Redefinition of:
VFS::size()
Retrieves the size of a file from the VFS.
write (line 188)

Store a file in the VFS, with the data copied from a temporary file.

  • return: True on success or a PEAR_Error object on failure.
mixed write (string $path, string $name, string $tmpFile, [boolean $autocreate = true])
  • 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?

Redefinition of:
VFS::write()
Stores a file in the VFS.

Redefined in descendants as:
writeData (line 314)

Store a file in the VFS from raw data.

  • return: True on success or a PEAR_Error object on failure.
mixed writeData (string $path, string $name, string $data, [boolean $autocreate = true])
  • 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?

Redefinition of:
VFS::writeData()
Stores a file in the VFS from raw data.

Redefined in descendants as:
_listFolder (line 475)

Return a list of the contents of a folder.

  • return: File list on success, PEAR_Error on error.
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?

Redefinition of:
VFS::_listFolder()
Returns an an unsorted file list of the specified directory.

Redefined in descendants as:

Inherited Methods

Inherited From VFS

 VFS::VFS()
 VFS::autocreatePath()
 VFS::changePermissions()
 VFS::checkCredentials()
 VFS::copy()
 VFS::createFolder()
 VFS::delete()
 VFS::deleteFile()
 VFS::deleteFolder()
 VFS::emptyFolder()
 VFS::exists()
 VFS::factory()
 VFS::getCurrentDirectory()
 VFS::getFolderSize()
 VFS::getModifiablePermissions()
 VFS::getParam()
 VFS::getQuota()
 VFS::getRequiredCredentials()
 VFS::getVFSSize()
 VFS::isFolder()
 VFS::listFolder()
 VFS::listFolders()
 VFS::log()
 VFS::move()
 VFS::read()
 VFS::readByteRange()
 VFS::readFile()
 VFS::rename()
 VFS::setLogger()
 VFS::setParams()
 VFS::setQuota()
 VFS::setQuotaRoot()
 VFS::singleton()
 VFS::size()
 VFS::strlen()
 VFS::strtolower()
 VFS::write()
 VFS::writeData()
 VFS::_copyRecursive()
 VFS::_getPath()
 VFS::_getTempDir()
 VFS::_getTempFile()
 VFS::_listFolder()

Documentation generated on Sun, 30 Jan 2011 05:17:15 +0000 by phpDocumentor 1.4.3