Documentation

Horde_Kolab_Storage_Driver_Mock extends Horde_Kolab_Storage_Driver_Base
in package

An Kolab storage mock driver.

Copyright 2010-2017 Horde LLC (http://www.horde.org/)

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

Tags
category

Kolab

author

Gunnar Wrobel wrobel@pardus.de

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$_namespace  : Horde_Kolab_Storage_Folder_Namespace
Memory cache for the namespace of this driver.
$charset  : string
Charset used by this driver.
$_backend  : mixed
The backend to use.
$_conversion_pattern  : string
The regular expression for converting folder names.
$_data  : Horde_Kolab_Storage_Driver_Mock_Data
The data of the folders.
$_factory  : Horde_Kolab_Storage_Factory
Factory for generating helper objects.
$_groups  : array<string|int, mixed>
A list of groups (associates users [key] with an array of group names [value]).
$_mbox  : array<string|int, mixed>
The data of the folder currently opened
$_mboxname  : array<string|int, mixed>
The name of the folder currently opened
$_params  : array<string|int, mixed>
Additional connection parameters.
__construct()  : mixed
Constructor.
appendMessage()  : mixed
Appends a message to the given folder.
create()  : null
Create the specified folder.
createBackend()  : mixed
Create the backend driver.
delete()  : null
Delete the specified folder.
deleteAcl()  : null
Delete the access rights for user on a folder.
deleteMessages()  : null
Deletes messages from the specified folder.
expunge()  : null
Expunges messages in the current folder.
fetchBodypart()  : resource
Retrieves a bodypart for the given message ID and mime part ID.
fetchComplete()  : array<string|int, mixed>
Retrieves a complete message.
fetchHeaders()  : Horde_Mime_Headers
Retrieves the message headers.
fetchStructure()  : array<string|int, mixed>
Retrieves the messages for the given message ids.
getAcl()  : array<string|int, mixed>
Retrieve the access rights for a folder.
getAnnotation()  : string
Fetches the annotation from a folder.
getAuth()  : string
Return the id of the user currently authenticated.
getBackend()  : mixed
Returns the actual backend driver.
getId()  : string
Return the unique connection id.
getModifiable()  : Horde_Kolab_Storage_Driver_Modifiable
Return a modifiable message object.
getMyAcl()  : string
Retrieve the access rights the current user has on a folder.
getNamespace()  : Horde_Kolab_Storage_Folder_Namespace
Retrieve the namespace information for this connection.
getParam()  : mixed
Return a parameter setting for this connection.
getParameters()  : array<string|int, mixed>
Return the connection parameters.
getParams()  : array<string|int, mixed>
Return all parameter settings for this connection.
getStamp()  : Horde_Kolab_Storage_Folder_Stamp
Returns a stamp for the current folder status. This stamp can be used to identify changes in the folder data.
getStampFromToken()  : Horde_Kolab_Storage_Folder_Stamp
Returns a stamp for the current folder status. This stamp can be used to identify changes in the folder data. This method, as opposed to self::getStamp(), uses the IMAP client's token to calculate the changes.
getUids()  : array<string|int, mixed>
Returns the message ids of the messages in this folder.
hasAclSupport()  : bool
Does the backend support ACL?
hasCatenateSupport()  : bool
Checks if the backend supports CATENATE.
listAnnotation()  : array<string|int, mixed>
Retrieves the specified annotation for the complete list of folders.
listFolders()  : array<string|int, mixed>
Retrieves a list of folders on the server.
moveMessage()  : null
Moves a message to a new folder.
rename()  : null
Rename the specified folder.
select()  : null
Opens the given folder.
setAcl()  : null
Set the access rights for a folder.
setAnnotation()  : null
Sets the annotation on a folder.
setBackend()  : null
Set the backend driver.
setGroups()  : null
Set a group list.
setParam()  : null
Set a parameter setting for this connection.
status()  : array<string|int, mixed>
Returns the status of the current folder.
_getAnnotateMoreEntry()  : array<string|int, mixed>
Split a name for the METADATA extension into the correct syntax for the older ANNOTATEMORE version.
decodeList()  : array<string|int, mixed>
Decode a list of IMAP path names from the driver charset to UTF-8.
decodeListKeys()  : array<string|int, mixed>
Decode the keys of a list of IMAP path names from the driver charset to UTF-8.
decodePath()  : string
Decode IMAP path names from the driver charset to UTF-8.
encodePath()  : string
Encode IMAP path names from UTF-8 to the driver charset.
getFactory()  : Horde_Kolab_Storage_Factory
Return the factory.
_convertToExternal()  : string
Convert the internal folder name into an external folder id.
_convertToInternal()  : string
Convert the external folder id to an internal folder name.
_failOnMissingFolder()  : null
Error out in case the provided folder is missing.
_failOnNoAdmin()  : null
Error out in case the user is no admin of the specified folder.
_folderAdmin()  : bool
Is the user a folder admin (or one of the global groups)?
_folderAdminForGroup()  : bool
Is the folder visible to a group the user belongs to?
_folderAdminForUnique()  : bool
Is the exact specified user an admin for the folder?
_folderMissing()  : null
Error out indicating that the user does not have the required permissions.
_folderVisible()  : bool
Is the folder visible to the specified user (or a global group)?
_folderVisibleToGroup()  : bool
Is the folder visible to a group the user belongs to?
_folderVisibleToUnique()  : bool
Is the folder visible to exactly the specified user?
_permissionDenied()  : null
Error out indicating that the user does not have the required permissions.

Properties

$charset

Charset used by this driver.

protected string $charset = 'UTF7-IMAP'

$_backend

The backend to use.

private mixed $_backend

$_conversion_pattern

The regular expression for converting folder names.

private string $_conversion_pattern

$_groups

A list of groups (associates users [key] with an array of group names [value]).

private array<string|int, mixed> $_groups = array()

$_mbox

The data of the folder currently opened

private array<string|int, mixed> $_mbox = \null

$_mboxname

The name of the folder currently opened

private array<string|int, mixed> $_mboxname = \null

$_params

Additional connection parameters.

private array<string|int, mixed> $_params

Methods

__construct()

Constructor.

public __construct(Horde_Kolab_Storage_Factory $factory[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
$factory : Horde_Kolab_Storage_Factory

A factory for helper objects.

$params : array<string|int, mixed> = array()

Connection parameters.

Return values
mixed

appendMessage()

Appends a message to the given folder.

public appendMessage(string $folder, resource $msg) : mixed
Parameters
$folder : string

The folder to append the message(s) to.

$msg : resource

The message to append.

Return values
mixed

True or the UID of the new message in case the backend supports UIDPLUS.

create()

Create the specified folder.

public create(string $folder) : null
Parameters
$folder : string

The folder to create.

Return values
null

createBackend()

Create the backend driver.

public createBackend() : mixed
Return values
mixed

The backend driver.

delete()

Delete the specified folder.

public delete(string $folder) : null
Parameters
$folder : string

The folder to delete.

Return values
null

deleteAcl()

Delete the access rights for user on a folder.

public deleteAcl(string $folder, string $user) : null
Parameters
$folder : string

The folder to act upon.

$user : string

The user to delete the ACL for

Return values
null

deleteMessages()

Deletes messages from the specified folder.

public deleteMessages(string $folder, int $uids) : null
Parameters
$folder : string

The folder to delete messages from.

$uids : int

IMAP message ids.

Return values
null

expunge()

Expunges messages in the current folder.

public expunge(string $folder) : null
Parameters
$folder : string

The folder to expunge.

Return values
null

fetchBodypart()

Retrieves a bodypart for the given message ID and mime part ID.

public fetchBodypart(string $folder, array<string|int, mixed> $uid, array<string|int, mixed> $id) : resource
Parameters
$folder : string

The folder to fetch the messages from.

$uid : array<string|int, mixed>

The message UID.

$id : array<string|int, mixed>

The mime part ID.

Return values
resource

The body part, as a stream resource.

fetchComplete()

Retrieves a complete message.

public fetchComplete(string $folder, array<string|int, mixed> $uid) : array<string|int, mixed>
Parameters
$folder : string

The folder to fetch the messages from.

$uid : array<string|int, mixed>

The message UID.

Return values
array<string|int, mixed>

The message encapsuled as an array that contains a Horde_Mime_Headers and a Horde_Mime_Part object.

fetchHeaders()

Retrieves the message headers.

public fetchHeaders(string $folder, array<string|int, mixed> $uid) : Horde_Mime_Headers
Parameters
$folder : string

The folder to fetch the message from.

$uid : array<string|int, mixed>

The message UID.

Return values
Horde_Mime_Headers

The message headers.

fetchStructure()

Retrieves the messages for the given message ids.

public fetchStructure(string $folder, array<string|int, mixed> $uids) : array<string|int, mixed>
Parameters
$folder : string

The folder to fetch the messages from.

$uids : array<string|int, mixed>

The message UIDs.

Return values
array<string|int, mixed>

An array of message structures parsed into Horde_Mime_Part instances.

getAcl()

Retrieve the access rights for a folder.

public getAcl(string $folder) : array<string|int, mixed>
Parameters
$folder : string

The folder to retrieve the ACL for.

Return values
array<string|int, mixed>

An array of rights.

getAnnotation()

Fetches the annotation from a folder.

public getAnnotation(string $folder, string $annotation) : string
Parameters
$folder : string

The name of the folder.

$annotation : string

The annotation to get.

Return values
string

The annotation value.

getAuth()

Return the id of the user currently authenticated.

public getAuth() : string
Return values
string

The id of the user that opened the IMAP connection.

getBackend()

Returns the actual backend driver.

public getBackend() : mixed

If there is no driver set the driver should be constructed within this method.

Return values
mixed

The backend driver.

getId()

Return the unique connection id.

public getId() : string
Return values
string

The connection id.

getModifiable()

Return a modifiable message object.

public getModifiable(string $folder, string $obid, array<string|int, mixed> $object) : Horde_Kolab_Storage_Driver_Modifiable
Parameters
$folder : string

The folder to access.

$obid : string

The backend ID of the object to retrieve from the folder.

$object : array<string|int, mixed>

The object data.

Return values
Horde_Kolab_Storage_Driver_Modifiable

The modifiable message object.

getMyAcl()

Retrieve the access rights the current user has on a folder.

public getMyAcl(string $folder) : string
Parameters
$folder : string

The folder to retrieve the user ACL for.

Return values
string

The user rights.

getParam()

Return a parameter setting for this connection.

public getParam(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string

The parameter key.

$default : mixed = null

An optional default value.

Return values
mixed

The parameter value.

getParameters()

Return the connection parameters.

public getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

The connection parameters.

getParams()

Return all parameter settings for this connection.

public getParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

The parameters.

getStamp()

Returns a stamp for the current folder status. This stamp can be used to identify changes in the folder data.

public getStamp(string $folder) : Horde_Kolab_Storage_Folder_Stamp
Parameters
$folder : string

Return the stamp for this folder.

Return values
Horde_Kolab_Storage_Folder_Stamp

A stamp indicating the current folder status.

getStampFromToken()

Returns a stamp for the current folder status. This stamp can be used to identify changes in the folder data. This method, as opposed to self::getStamp(), uses the IMAP client's token to calculate the changes.

public getStampFromToken(string $folder, string $token, array<string|int, mixed> $ids) : Horde_Kolab_Storage_Folder_Stamp
Parameters
$folder : string

Return the stamp for this folder.

$token : string

A sync token provided by the IMAP server.

$ids : array<string|int, mixed>

An array of UIDs that we know about.

Return values
Horde_Kolab_Storage_Folder_Stamp

A stamp indicating the current folder status.

getUids()

Returns the message ids of the messages in this folder.

public getUids(string $folder) : array<string|int, mixed>
Parameters
$folder : string

Check the status of this folder.

Return values
array<string|int, mixed>

The message ids.

hasAclSupport()

Does the backend support ACL?

public hasAclSupport() : bool
Return values
bool

True if the backend supports ACLs.

hasCatenateSupport()

Checks if the backend supports CATENATE.

public hasCatenateSupport() : bool
Return values
bool

True if the backend supports CATENATE.

listAnnotation()

Retrieves the specified annotation for the complete list of folders.

public listAnnotation(string $annotation) : array<string|int, mixed>
Parameters
$annotation : string

The name of the annotation to retrieve.

Return values
array<string|int, mixed>

An associative array combining the folder names as key with the corresponding annotation value.

listFolders()

Retrieves a list of folders on the server.

public listFolders() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of folders.

moveMessage()

Moves a message to a new folder.

public moveMessage(int $uid, string $old_folder, string $new_folder) : null
Parameters
$uid : int

IMAP message id.

$old_folder : string

Source folder.

$new_folder : string

Target folder.

Return values
null

rename()

Rename the specified folder.

public rename(string $old, string $new) : null
Parameters
$old : string

The folder to rename.

$new : string

The new name of the folder.

Return values
null

select()

Opens the given folder.

public select(string $folder) : null
Parameters
$folder : string

The folder to open

Return values
null

setAcl()

Set the access rights for a folder.

public setAcl(string $folder, string $user, string $acl) : null
Parameters
$folder : string

The folder to act upon.

$user : string

The user to set the ACL for.

$acl : string

The ACL.

Return values
null

setAnnotation()

Sets the annotation on a folder.

public setAnnotation(string $folder, string $annotation, array<string|int, mixed> $value) : null
Parameters
$folder : string

The name of the folder.

$annotation : string

The annotation to set.

$value : array<string|int, mixed>

The values to set

Return values
null

setBackend()

Set the backend driver.

public setBackend(mixed $backend) : null
Parameters
$backend : mixed

The driver that should be used.

Return values
null

setGroups()

Set a group list.

public setGroups(array<string|int, mixed> $groups) : null
Parameters
$groups : array<string|int, mixed>

A list of groups. User names are the keys, an array of group names are the values.

Return values
null

setParam()

Set a parameter setting for this connection.

public setParam(string $key, mixed $value) : null
Parameters
$key : string

The parameter key.

$value : mixed

The parameter value.

Return values
null

status()

Returns the status of the current folder.

public status(string $folder) : array<string|int, mixed>
Parameters
$folder : string

Check the status of this folder.

Return values
array<string|int, mixed>

An array that contains 'uidvalidity', 'uidnext', and 'token'.

_getAnnotateMoreEntry()

Split a name for the METADATA extension into the correct syntax for the older ANNOTATEMORE version.

protected _getAnnotateMoreEntry(string $name) : array<string|int, mixed>
Parameters
$name : string

A name for a metadata entry.

Tags
throws
Horde_Imap_Client_Exception
Return values
array<string|int, mixed>

A list of two elements: The entry name and the value type.

decodeList()

Decode a list of IMAP path names from the driver charset to UTF-8.

protected decodeList(array<string|int, mixed> $list) : array<string|int, mixed>
Parameters
$list : array<string|int, mixed>

The the driver charset encoded path names.

Return values
array<string|int, mixed>

The path names in UTF-8.

decodeListKeys()

Decode the keys of a list of IMAP path names from the driver charset to UTF-8.

protected decodeListKeys(array<string|int, mixed> $list) : array<string|int, mixed>
Parameters
$list : array<string|int, mixed>

The list with the driver charset encoded path names as keys.

Return values
array<string|int, mixed>

The list with path names in UTF-8 as keys.

decodePath()

Decode IMAP path names from the driver charset to UTF-8.

protected decodePath(string $path) : string
Parameters
$path : string

The the driver charset encoded path name.

Return values
string

The path name in UTF-8.

encodePath()

Encode IMAP path names from UTF-8 to the driver charset.

protected encodePath(string $path) : string
Parameters
$path : string

The UTF-8 encoded path name.

Return values
string

The path name in the driver charset.

_convertToExternal()

Convert the internal folder name into an external folder id.

private _convertToExternal(string $mbox) : string
Parameters
$mbox : string

The internal folder name.

Return values
string

The external folder id.

_convertToInternal()

Convert the external folder id to an internal folder name.

private _convertToInternal(string $folder) : string
Parameters
$folder : string

The external folder name.

Return values
string

The internal folder id.

_failOnMissingFolder()

Error out in case the provided folder is missing.

private _failOnMissingFolder(string $folder) : null
Parameters
$folder : string

The folder.

Tags
throws
Horde_Kolab_Storage_Exception

In case the folder is missing.

Return values
null

_failOnNoAdmin()

Error out in case the user is no admin of the specified folder.

private _failOnNoAdmin(string $folder) : null
Parameters
$folder : string

The folder.

Tags
throws
Horde_Kolab_Storage_Exception

In case the user has no admin rights.

Return values
null

_folderAdmin()

Is the user a folder admin (or one of the global groups)?

private _folderAdmin(string $folder, string $user) : bool
Parameters
$folder : string

The folder.

$user : string

The user.

Return values
bool

True if the user has admin rights on the folder.

_folderAdminForGroup()

Is the folder visible to a group the user belongs to?

private _folderAdminForGroup(string $folder, string $user) : bool
Parameters
$folder : string

The folder.

$user : string

The user.

Return values
bool

True if the folder is visible.

_folderAdminForUnique()

Is the exact specified user an admin for the folder?

private _folderAdminForUnique(string $folder, string $user) : bool
Parameters
$folder : string

The folder.

$user : string

The user.

Return values
bool

True if the user has admin rights on the folder.

_folderMissing()

Error out indicating that the user does not have the required permissions.

private _folderMissing(string $folder) : null
Parameters
$folder : string

The folder.

Tags
throws
Horde_Kolab_Storage_Exception

In case the folder is missing.

Return values
null

_folderVisible()

Is the folder visible to the specified user (or a global group)?

private _folderVisible(string $folder, string $user) : bool
Parameters
$folder : string

The folder.

$user : string

The user.

Return values
bool

True if the folder is visible.

_folderVisibleToGroup()

Is the folder visible to a group the user belongs to?

private _folderVisibleToGroup(string $folder, string $user) : bool
Parameters
$folder : string

The folder.

$user : string

The user.

Return values
bool

True if the folder is visible.

_folderVisibleToUnique()

Is the folder visible to exactly the specified user?

private _folderVisibleToUnique(string $folder, string $user) : bool
Parameters
$folder : string

The folder.

$user : string

The user.

Return values
bool

True if the folder is visible.

_permissionDenied()

Error out indicating that the user does not have the required permissions.

private _permissionDenied() : null
Tags
throws
Horde_Kolab_Storage_Exception

In case the folder is missing.

Return values
null

Search results