VFS implementation for a filesystem.
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.
Methods summary
public
|
#
__construct( array $params = array() )
Constructs a new Filesystem based VFS object.
Constructs a new Filesystem based VFS object.
Parameters
- $params
- <p>A hash containing connection parameters. REQUIRED
parameters:
- vfsroot: (string) The root path.
Note: The user that your webserver runs as MUST have
read/write permission to this directory.</p>
Overrides
|
public
integer
|
#
size( string $path, string $name )
Retrieves the filesize from the VFS.
Retrieves the filesize from the VFS.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
Returns
integer The file size.
Throws
Overrides
|
public
string
|
#
read( string $path, string $name )
Retrieve a file from the VFS.
Retrieve a file from the VFS.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
Returns
string The file data.
Throws
Overrides
|
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
Overrides
|
public
resource
|
#
readStream( string $path, string $name )
Open a read-only stream to a file in the VFS.
Open a read-only stream to a file in the VFS.
Parameters
- $path
- The pathname to the file.
- $name
- The filename to retrieve.
Returns
resource The stream.
Throws
|
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
Overrides
|
public
|
#
write( string $path, string $name, string $tmpFile, boolean $autocreate = false )
Store a file in the VFS, with the data copied from a temporary
file.
Store a file in the VFS, with the data copied from a temporary
file.
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
Overrides
|
public
|
#
move( string $path, string $name, string $dest, boolean $autocreate = false )
Moves a file in the database and the file system.
Moves a file in the database and the file system.
Parameters
- $path
- The path to store the file in.
- $name
- The filename to use.
- $dest
- The destination of the file.
- $autocreate
- Automatically create directories?
Throws
Overrides
|
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 to store the file in.
- $name
- The filename to use.
- $dest
- The destination of the file.
- $autocreate
- Automatically create directories?
Throws
Overrides
|
public
|
#
writeData( string $path, string $name, string $data, boolean $autocreate = false )
Store a file in the VFS from raw data.
Store 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
Overrides
|
public
|
#
deleteFile( string $path, string $name )
Delete a file from the VFS.
Delete a file from the VFS.
Parameters
- $path
- The path to store the file in.
- $name
- The filename to use.
Throws
Overrides
|
public
|
#
deleteFolder( string $path, string $name, boolean $recursive = false )
Delete a folder from the VFS.
Delete a folder from the VFS.
Parameters
- $path
- The path to delete the folder from.
- $name
- The foldername to use.
- $recursive
- Force a recursive delete?
Throws
Overrides
|
public
|
#
createFolder( string $path, string $name )
Creates a folder on the VFS.
Creates a folder on the VFS.
Parameters
- $path
- The path to create the folder in.
- $name
- The foldername to use.
Throws
Overrides
|
public
boolean
|
#
isFolder( string $path, string $name )
Check if a given pathname is a folder.
Check if a given pathname is a folder.
Parameters
- $path
- The path to the folder.
- $name
- The file/folder name.
Returns
boolean True if it is a folder, false otherwise.
Overrides
|
public
|
#
changePermissions( string $path, string $name, string $permission )
Changes permissions for an item in the VFS.
Changes permissions for an item in the VFS.
Parameters
- $path
- The path of directory of the item.
- $name
- The name of the item.
- $permission
- The permission to set in octal notation.
Throws
Overrides
|
public
array
|
#
listFolders( string $path = '', mixed $filter = null, boolean $dotfolders = true )
Returns a sorted list of folders in specified directory.
Returns a sorted list of folders in 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
Overrides
|
public
|
#
rename( string $oldpath, string $oldname, string $newpath, string $newname )
Rename a file or folder in the VFS.
Rename a file or folder 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
Overrides
|
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.
Overrides
|