Overview

Packages

  • Vfs

Classes

  • Horde_Vfs
  • Horde_Vfs_Base
  • Horde_Vfs_Browser
  • Horde_Vfs_Exception
  • Horde_Vfs_File
  • Horde_Vfs_Ftp
  • Horde_Vfs_Gc
  • Horde_Vfs_Horde
  • Horde_Vfs_Kolab
  • Horde_Vfs_ListItem
  • Horde_Vfs_Musql
  • Horde_Vfs_Object
  • Horde_Vfs_Smb
  • Horde_Vfs_Sql
  • Horde_Vfs_SqlFile
  • Horde_Vfs_Ssh2
  • Horde_Vfs_Translation
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Vfs_Base

VFS API for abstracted file storage and access.

Copyright 2002-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Direct known subclasses

Horde_Vfs_File, Horde_Vfs_Ftp, Horde_Vfs_Horde, Horde_Vfs_Kolab, Horde_Vfs_Smb, Horde_Vfs_Sql, Horde_Vfs_Ssh2

Indirect known subclasses

Horde_Vfs_Musql, Horde_Vfs_SqlFile
Abstract
Package: Vfs
Author: Chuck Hagenbuch chuck@horde.org
Located at Horde/Vfs/Base.php
Methods summary
public
# __construct( array $params = array() )

Constructor.

Constructor.

Parameters

$params
A hash containing connection parameters.
public
# checkCredentials( )

Checks the credentials that we have by calling _connect(), to see if there is a valid login.

Checks the credentials that we have by calling _connect(), to see if there is a valid login.

Throws

Horde_Vfs_Exception
public
# setParams( array $params = array() )

Sets configuration parameters.

Sets configuration parameters.

Parameters

$params
<p>An associative array with parameter names as keys.</p>
public mixed
# getParam( string $name )

Returns configuration parameters.

Returns configuration parameters.

Parameters

$name
The parameter to return.

Returns

mixed
The parameter value or null if it doesn't exist.
public integer
# size( string $path, string $name )

Retrieves the size of a file from the VFS.

Retrieves the size of a file from the VFS.

Parameters

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

Returns

integer
The file size.

Throws

Horde_Vfs_Exception
public integer
# getFolderSize( string $path = null, string $name = null )

Returns the size of a folder

Returns the size of a folder

Parameters

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

Returns

integer
The size of the folder, in bytes.

Throws

Horde_Vfs_Exception
public string
# read( string $path, string $name )

Retrieves a file from the VFS.

Retrieves a file from the VFS.

Parameters

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

Returns

string
The file data.

Throws

Horde_Vfs_Exception
public string
# readFile( string $path, string $name )

Retrieves a file from the VFS as an on-disk local file.

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

Parameters

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

Returns

string
A local filename.

Throws

Horde_Vfs_Exception
public string
# readByteRange( string $path, string $name, integer & $offset, integer $length, 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.

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

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

Returns

string
The file data.

Throws

Horde_Vfs_Exception
public
# write( string $path, string $name, string $tmpFile, boolean $autocreate = false )

Stores a file in the VFS.

Stores a file in the VFS.

Parameters

$path
The path to store the file in.
$name
The filename to use.
$tmpFile
<p>The temporary file containing the data to be stored.</p>
$autocreate
Automatically create directories?

Throws

Horde_Vfs_Exception
public
# writeData( string $path, string $name, string $data, boolean $autocreate = false )

Stores a file in the VFS from raw data.

Stores a file in the VFS from raw data.

Parameters

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

Throws

Horde_Vfs_Exception
public
# move( string $path, string $name, string $dest, boolean $autocreate = false )

Moves a file through the backend.

Moves a file through the backend.

Parameters

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

Throws

Horde_Vfs_Exception
public
# copy( string $path, string $name, string $dest, boolean $autocreate = false )

Copies a file through the backend.

Copies a file through the backend.

Parameters

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

Throws

Horde_Vfs_Exception
public
# delete( mixed $path, mixed $name )

Alias to deleteFile()

Alias to deleteFile()

public
# deleteFile( string $path, string $name )

Deletes a file from the VFS.

Deletes a file from the VFS.

Parameters

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

Throws

Horde_Vfs_Exception
public
# rename( string $oldpath, string $oldname, string $newpath, string $newname )

Renames a file in the VFS.

Renames a file in the VFS.

Parameters

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

Throws

Horde_Vfs_Exception
public boolean
# exists( string $path, string $name )

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

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

Parameters

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

Returns

boolean
True if it exists, false otherwise.
public
# createFolder( string $path, string $name )

Creates a folder in the VFS.

Creates a folder in the VFS.

Parameters

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

Throws

Horde_Vfs_Exception
public
# autocreatePath( string $path )

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

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

Parameters

$path
The VFS path to autocreate.

Throws

Horde_Vfs_Exception
public boolean
# isFolder( string $path, string $name )

Checks if a given item is a folder.

Checks if a given item is a folder.

Parameters

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

Returns

boolean
True if it is a folder, false otherwise.
public
# deleteFolder( string $path, string $name, boolean $recursive = false )

Deletes a folder from the VFS.

Deletes a folder from the VFS.

Parameters

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

Throws

Horde_Vfs_Exception
public
# emptyFolder( string $path )

Recursively remove all files and subfolders from the given folder.

Recursively remove all files and subfolders from the given folder.

Parameters

$path
The path of the folder to empty.

Throws

Horde_Vfs_Exception
public 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.

Returns a file list of the directory passed in.

Parameters

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

Returns

array
File list.

Throws

Horde_Vfs_Exception
public string
# getCurrentDirectory( )

Returns the current working directory of the VFS backend.

Returns the current working directory of the VFS backend.

Returns

string
The current working directory.
public
# changePermissions( string $path, string $name, string $permission )

Changes permissions for an item on the VFS.

Changes permissions for an item on the VFS.

Parameters

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

Throws

Horde_Vfs_Exception
public array
# listFolders( string $path = '', mixed $filter = null, boolean $dotfolders = true )

Returns a sorted list of folders in the specified directory.

Returns a sorted list of folders in the specified directory.

Parameters

$path
<p>The path of the directory to get the directory list for.</p>
$filter
Hash of items to filter based on folderlist.
$dotfolders
Include dotfolders?

Returns

array
Folder list.

Throws

Horde_Vfs_Exception
public array
# getRequiredCredentials( )

Returns the list of additional credentials required, if any.

Returns the list of additional credentials required, if any.

Returns

array
Credential list.
public array
# getModifiablePermissions( )

Returns an array specifying what permissions are changeable for this VFS implementation.

Returns an array specifying what permissions are changeable for this VFS implementation.

Returns

array
Changeable permisions.
public integer
# getVFSSize( )

Returns the size of the VFS item.

Returns the size of the VFS item.

Returns

integer
The size, in bytes, of the VFS item.
public
# setQuota( integer $quota, integer $metric = Horde_Vfs::QUOTA_METRIC_BYTE )

Sets the VFS quota limit.

Sets the VFS quota limit.

Parameters

$quota
The limit to apply.
$metric
The metric to multiply the quota into.
public
# setQuotaRoot( string $dir )

Sets the VFS quota root.

Sets the VFS quota root.

Parameters

$dir
The root directory for the quota determination.
public mixed
# getQuota( )

Get quota information (used/allocated), in bytes.

Get quota information (used/allocated), in bytes.

Returns

mixed
An associative array.
'limit' = Maximum quota allowed
'usage' = Currently used portion of quota (in bytes)

Throws

Horde_Vfs_Exception
API documentation generated by ApiGen