Class VFS_sql

Description

VFS implementation for PHP's PEAR database abstraction layer.

Required values for $params:

   'phptype'      The database type (ie. 'pgsql', 'mysql', etc.).

Optional values:

   'table'          The name of the vfs table in 'database'. Defaults to
                    'horde_vfs'.

Required by some database implementations:

   'hostspec'     The hostname of the database server.
   'protocol'     The communication protocol ('tcp', 'unix', etc.).
   'database'     The name of the database.
   'username'     The username with which to connect to the database.
   'password'     The password associated with 'username'.
   'options'      Additional options to pass to the database.
   'tty'          The TTY on which to connect to the database.
   'port'         The port on which to connect to the database.

Optional values when using separate reading and writing servers, for example in replication settings:

   'splitread'   Boolean, whether to implement the separation or not.
   'read'        Array containing the parameters which are different for
                 the read database connection, currently supported
                 only 'hostspec' and 'port' parameters.

The table structure for the VFS can be found in data/vfs.sql.

Database specific notes:

MSSQL:

 - The vfs_data field must be of type IMAGE.
 - You need the following php.ini settings:
    ; Valid range 0 - 2147483647. Default = 4096.
    mssql.textlimit = 0 ; zero to pass through

    ; Valid range 0 - 2147483647. Default = 4096.
    mssql.textsize = 0 ; zero to pass through

$Horde: framework/VFS/lib/VFS/sql.php,v 1.1.2.7 2011-01-12 10:56:42 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.

Located in /VFS/lib/VFS/sql.php (line 65)

VFS
   |
   --VFS_sql
Direct descendents
Class Description
 class VFS_musql Multi User VFS implementation for PHP's PEAR database abstraction layer.
Variable Summary
 boolean $_connected
 DB $_db
Method Summary
 mixed createFolder (string $path, string $name)
 mixed deleteFile (string $path, string $name)
 mixed deleteFolder (string $path, string $name, [boolean $recursive = false])
 void gc (string $path, [integer $secs = 345600])
 integer getFolderSize ([string $path = null], [string $name = null])
 boolean isFolder (string $path, string $name)
 mixed listFolders ([string $path = ''], [mixed $filter = array()], [boolean $dotfolders = true])
 string read (string $path, string $name)
 string readByteRange (string $path, string $name,  &$offset, [integer $length = -1],  &$remaining, integer $offset, integer $remaining)
 mixed rename (string $oldpath, string $oldname, string $newpath, string $newname)
 int size (string $path, string $name)
 mixed write (string $path, string $name, string $tmpFile, [boolean $autocreate = false])
 mixed writeData (string $path, string $name, string $data, [boolean $autocreate = false])
 void _getFileSizeOp ()
 mixed _listFolder (string $path, [mixed $filter = null], [boolean $dotfiles = true], [boolean $dironly = false])
Variables
boolean $_connected = false (line 88)

Boolean indicating whether or not we're connected to the SQL server.

DB $_db = false (line 72)

Handle for the current database connection.

DB $_write_db (line 80)

Handle for the current database connection, used for writing. Defaults to the same handle as $_db if a separate write database is not required.

Inherited Variables

Inherited from VFS

VFS::$_credentials
VFS::$_logger
VFS::$_logLevel
VFS::$_params
VFS::$_permissions
VFS::$_vfsSize
Methods
createFolder (line 411)

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: Holds the path of directory to create folder.
  • string $name: Holds the name of the new folder.

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

Redefined in descendants as:
deleteFile (line 322)

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 442)

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 of the folder.
  • string $name: The folder name to use.
  • boolean $recursive: Force a recursive delete?

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

Redefined in descendants as:
gc (line 669)

Garbage collect files in the VFS storage system.

void gc (string $path, [integer $secs = 345600])
  • string $path: The VFS path to clean.
  • integer $secs: The minimum amount of time (in seconds) required before a file is removed.
getFolderSize (line 133)

Returns the size of a file.

  • return: The size of the folder in bytes or PEAR_Error on failure.
  • access: public
integer getFolderSize ([string $path = null], [string $name = null])
  • string $path: The path of the file.
  • string $name: The filename.

Redefinition of:
VFS::getFolderSize()
Returns the size of a folder
isFolder (line 1109)

VFS_sql override of isFolder() to check for root folder.

  • return: True if $path/$name is a folder
boolean isFolder (string $path, string $name)
  • string $path: Path to possible folder
  • string $name: Name of possible folder

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

Returns a sorted list of folders in specified directory.

  • return: Folder list on success or PEAR_Error object on failure.
mixed listFolders ([string $path = ''], [mixed $filter = array()], [boolean $dotfolders = true])
  • string $path: The path of the directory to get the directory list for.
  • mixed $filter: String/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.
read (line 162)

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 192)

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.
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.
rename (line 360)

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 98)

Retrieves the filesize from the VFS.

  • return: The file size.
int 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 231)

Stores a file in the VFS.

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

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

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 = 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?

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

Redefined in descendants as:
_getFileSizeOp (line 1082)

TODO

void _getFileSizeOp ()
_listFolder (line 514)

Return a list of the contents of a folder.

  • return: File list on success or false on failure.
mixed _listFolder (string $path, [mixed $filter = null], [boolean $dotfiles = true], [boolean $dironly = false])
  • string $path: The directory path.
  • mixed $filter: String/hash of items to filter based on filename.
  • boolean $dotfiles: Show dotfiles?
  • boolean $dironly: Show directories only?

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:21:43 +0000 by phpDocumentor 1.4.3