PHP Класс Horde_SyncMl_Sync, horde

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Автор: Anthony Mills ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_clientAnchorNext integer Sync Anchors determine the interval from which changes are retrieved.
$_client_add_count integer Number of objects that have been sent to the server for adding.
$_client_addreplaces integer Add due to client replace request when map entry is not found. Happens during SlowSync.
$_client_delete_count integer Number of objects that have been sent to the server for deletion.
$_client_replace_count integer Number of objects that have been sent to the server for replacement.
$_errors integer Number of failed actions, for logging purposes only.
$_expectingMapData boolean Map data is expected whenever an add is sent to the client.
$_serverAnchorLast
$_serverAnchorNext
$_server_add_count integer Number of objects that have been sent to the client for adding.
$_server_adds array List of object UIDs (in the keys) that have been added on the server since the last synchronization and are supposed to be sent to the client.
$_server_delete_count integer Number of objects that have been sent to the client for deletion.
$_server_deletes array List of object UIDs (in the keys) that have been deleted on the server since the last synchronization and are supposed to be sent to the client.
$_server_largeobj array Array holding the remaining content when splitting a large object into multiple messages. Keys are numeric, values are: command, chunkContent, clientContentType, clientEncodingType, cuid, suid
$_server_replace_count integer Number of objects that have been sent to the client for replacement.
$_server_replaces array List of object UIDs (in the keys) that have been changed on the server since the last synchronization and are supposed to be sent to the client.
$_server_task_adds array This is only used for clients handling tasks and events in one database. We need to seperately store the server tasks adds, so when we get a Map command from the client, we know whether to put this in tasks or calendar.
$_sourceLocURI string Source (server) URI (database).
$_state constant A sync starts in Horde_SyncMl_Sync::STATE_INIT and moves on to the next state with every received from the client: Horde_SyncMl_Sync::STATE_INIT, Horde_SyncMl_Sync::STATE_SYNC, Horde_SyncMl_Sync::STATE_MAP, Horde_SyncMl_Sync::STATE_COMPLETED. Horde_SyncMl_Sync::STATE_MAP doesn't occur for _FROM_CLIENT syncs.
$_syncType integer The synchronization method, one of the Horde_SyncMl::ALERT_* constants.
$_syncsReceived integer Counts the s received by the server. Currently unused.
$_syncsSent integer Counts the s sent by the server.
$_targetLocURI string Target (client) URI (database).

Открытые методы

Метод Описание
__construct ( string $syncType, string $serverURI, string $clientURI, integer $serverAnchorLast, integer $serverAnchorNext, string $clientAnchorNext )
addSyncReceived ( )
closeSync ( ) Completes a sync once everything is done: store the sync anchors so the next sync can be a delta sync and produce some debug info.
createSyncOutput ( &$output ) Creates a output containing the server changes.
createUidMap ( $databaseURI, $cuid, $suid )
getClientAnchorNext ( )
getClientLocURI ( )
getServerAnchorLast ( )
getServerAnchorNext ( )
getServerChange ( string $change, string $id ) : string Returns the client ID of server change identified by the change type and server ID.
getServerLocURI ( )
getSyncsReceived ( ) * Currently unused
handleClientSyncItem ( &$output, Horde_SyncMl_SyncElement &$item ) Here's where the actual processing of a client-sent Sync Item takes place. Entries are added, deleted or replaced from the server database by using backend API calls.
handleFinal ( &$output, $debug = false ) Notifies the sync that a final has been received by the client.
hasPendingElements ( ) Returns true if there are still outstanding server sync items to be sent to the client.
isComplete ( )
setServerChange ( string $change, string $sid, string $cid ) Sets the client ID of server change identified by the change type and server ID.
unsetServerChange ( string $change, string $id ) Unsets the server-client-map of server change identified by the change type and server ID.

Защищенные методы

Метод Описание
_getServerLargeObjChunk ( integer $chunkLength ) : string Get the next chunk from the cached large object with maximum length of chunkLength or return false.
_retrieveChanges ( string $syncDB, array &$adds, array &$replaces, array &$deletes ) Retrieves and condenses the changes on the server side since the last synchronization.
_taskToCalendar ( $databaseURI ) Converts a calendar databaseURI to a tasks databaseURI for devices with handleTasksInCalendar.

Описание методов

__construct() публичный Метод

public __construct ( string $syncType, string $serverURI, string $clientURI, integer $serverAnchorLast, integer $serverAnchorNext, string $clientAnchorNext )
$syncType string
$serverURI string
$clientURI string
$serverAnchorLast integer
$serverAnchorNext integer
$clientAnchorNext string

_getServerLargeObjChunk() защищенный Метод

Get the next chunk from the cached large object with maximum length of chunkLength or return false.
protected _getServerLargeObjChunk ( integer $chunkLength ) : string
$chunkLength integer The maximum length of the chunk.
Результат string The next chunk of the cached large object.

_retrieveChanges() защищенный Метод

Retrieves and condenses the changes on the server side since the last synchronization.
protected _retrieveChanges ( string $syncDB, array &$adds, array &$replaces, array &$deletes )
$syncDB string The database being synchronized.
$adds array Will be set with the server-client-uid mappings of added objects.
$replaces array Will be set with the server-client-uid mappings of changed objects.
$deletes array Will be set with the server-client-uid mappings of deleted objects.

_taskToCalendar() защищенный Метод

Converts a calendar databaseURI to a tasks databaseURI for devices with handleTasksInCalendar.
protected _taskToCalendar ( $databaseURI )

addSyncReceived() публичный Метод

public addSyncReceived ( )

closeSync() публичный Метод

Completes a sync once everything is done: store the sync anchors so the next sync can be a delta sync and produce some debug info.
public closeSync ( )

createSyncOutput() публичный Метод

Creates a output containing the server changes.
public createSyncOutput ( &$output )

createUidMap() публичный Метод

public createUidMap ( $databaseURI, $cuid, $suid )

getClientAnchorNext() публичный Метод

public getClientAnchorNext ( )

getClientLocURI() публичный Метод

public getClientLocURI ( )

getServerAnchorLast() публичный Метод

public getServerAnchorLast ( )

getServerAnchorNext() публичный Метод

public getServerAnchorNext ( )

getServerChange() публичный Метод

Returns the client ID of server change identified by the change type and server ID.
public getServerChange ( string $change, string $id ) : string
$change string The change type (add, replace, delete).
$id string The object's server UID.
Результат string The matching client ID or null if none found.

getServerLocURI() публичный Метод

public getServerLocURI ( )

getSyncsReceived() публичный Метод

* Currently unused
public getSyncsReceived ( )

handleClientSyncItem() публичный Метод

Here's where the actual processing of a client-sent Sync Item takes place. Entries are added, deleted or replaced from the server database by using backend API calls.
public handleClientSyncItem ( &$output, Horde_SyncMl_SyncElement &$item )
$output
$item Horde_SyncMl_SyncElement

handleFinal() публичный Метод

Depending on the current state of the sync this can mean various things: a) Init phase (Alerts) done. Next package contaings actual syncs. b) Sync sending from client done. Next package are maps (or finish or finish if ONE_WAY_FROM_CLIENT sync c) Maps finished, completly done.
public handleFinal ( &$output, $debug = false )

hasPendingElements() публичный Метод

This is the case if the MaxMsgSize has been reached and the pending elements are to be sent in another message.
public hasPendingElements ( )

isComplete() публичный Метод

public isComplete ( )

setServerChange() публичный Метод

Sets the client ID of server change identified by the change type and server ID.
public setServerChange ( string $change, string $sid, string $cid )
$change string The change type (add, replace, delete).
$sid string The object's server UID.
$cid string The object's client UID.

unsetServerChange() публичный Метод

Unsets the server-client-map of server change identified by the change type and server ID.
public unsetServerChange ( string $change, string $id )
$change string The change type (add, replace, delete).
$id string The object's server UID.

Описание свойств

$_clientAnchorNext защищенное свойство

Sync Anchors determine the interval from which changes are retrieved.
protected int $_clientAnchorNext
Результат integer

$_client_add_count защищенное свойство

Number of objects that have been sent to the server for adding.
protected int $_client_add_count
Результат integer

$_client_addreplaces защищенное свойство

Add due to client replace request when map entry is not found. Happens during SlowSync.
protected int $_client_addreplaces
Результат integer

$_client_delete_count защищенное свойство

Number of objects that have been sent to the server for deletion.
protected int $_client_delete_count
Результат integer

$_client_replace_count защищенное свойство

Number of objects that have been sent to the server for replacement.
protected int $_client_replace_count
Результат integer

$_errors защищенное свойство

Number of failed actions, for logging purposes only.
protected int $_errors
Результат integer

$_expectingMapData защищенное свойство

Map data is expected whenever an add is sent to the client.
protected bool $_expectingMapData
Результат boolean

$_serverAnchorLast защищенное свойство

protected $_serverAnchorLast

$_serverAnchorNext защищенное свойство

protected $_serverAnchorNext

$_server_add_count защищенное свойство

Number of objects that have been sent to the client for adding.
protected int $_server_add_count
Результат integer

$_server_adds защищенное свойство

List of object UIDs (in the keys) that have been added on the server since the last synchronization and are supposed to be sent to the client.
protected array $_server_adds
Результат array

$_server_delete_count защищенное свойство

Number of objects that have been sent to the client for deletion.
protected int $_server_delete_count
Результат integer

$_server_deletes защищенное свойство

List of object UIDs (in the keys) that have been deleted on the server since the last synchronization and are supposed to be sent to the client.
protected array $_server_deletes
Результат array

$_server_largeobj защищенное свойство

Array holding the remaining content when splitting a large object into multiple messages. Keys are numeric, values are: command, chunkContent, clientContentType, clientEncodingType, cuid, suid
protected array $_server_largeobj
Результат array

$_server_replace_count защищенное свойство

Number of objects that have been sent to the client for replacement.
protected int $_server_replace_count
Результат integer

$_server_replaces защищенное свойство

List of object UIDs (in the keys) that have been changed on the server since the last synchronization and are supposed to be sent to the client.
protected array $_server_replaces
Результат array

$_server_task_adds защищенное свойство

This is only used for clients handling tasks and events in one database. We need to seperately store the server tasks adds, so when we get a Map command from the client, we know whether to put this in tasks or calendar.
protected array $_server_task_adds
Результат array

$_sourceLocURI защищенное свойство

Source (server) URI (database).
protected string $_sourceLocURI
Результат string

$_state защищенное свойство

A sync starts in Horde_SyncMl_Sync::STATE_INIT and moves on to the next state with every received from the client: Horde_SyncMl_Sync::STATE_INIT, Horde_SyncMl_Sync::STATE_SYNC, Horde_SyncMl_Sync::STATE_MAP, Horde_SyncMl_Sync::STATE_COMPLETED. Horde_SyncMl_Sync::STATE_MAP doesn't occur for _FROM_CLIENT syncs.
protected constant $_state
Результат constant

$_syncType защищенное свойство

The synchronization method, one of the Horde_SyncMl::ALERT_* constants.
protected int $_syncType
Результат integer

$_syncsReceived защищенное свойство

Counts the s received by the server. Currently unused.
protected int $_syncsReceived
Результат integer

$_syncsSent защищенное свойство

Counts the s sent by the server.
protected int $_syncsSent
Результат integer

$_targetLocURI защищенное свойство

Target (client) URI (database).
protected string $_targetLocURI
Результат string