Constants

STATE_INIT

STATE_INIT

STATE_SYNC

STATE_SYNC

STATE_MAP

STATE_MAP

STATE_COMPLETED

STATE_COMPLETED

Properties

$_targetLocURI

$_targetLocURI : string

Target (client) URI (database).

Type

string

$_sourceLocURI

$_sourceLocURI : string

Source (server) URI (database).

Type

string

$_syncType

$_syncType : integer

The synchronization method, one of the Horde_SyncMl::ALERT_* constants.

Type

integer

$_syncsSent

$_syncsSent : integer

Counts the <Sync>s sent by the server.

Type

integer

$_syncsReceived

$_syncsReceived : integer

Counts the <Sync>s received by the server. Currently unused.

Type

integer

$_expectingMapData

$_expectingMapData : boolean

Map data is expected whenever an add is sent to the client.

Type

boolean

$_state

$_state : \constant

State of the current sync.

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.

Type

\constant

$_clientAnchorNext

$_clientAnchorNext : integer

Sync Anchors determine the interval from which changes are retrieved.

Type

integer

$_serverAnchorLast

$_serverAnchorLast : 

Type

$_serverAnchorNext

$_serverAnchorNext : 

Type

$_client_add_count

$_client_add_count : integer

Number of objects that have been sent to the server for adding.

Type

integer

$_client_replace_count

$_client_replace_count : integer

Number of objects that have been sent to the server for replacement.

Type

integer

$_client_delete_count

$_client_delete_count : integer

Number of objects that have been sent to the server for deletion.

Type

integer

$_client_addreplaces

$_client_addreplaces : integer

Add due to client replace request when map entry is not found. Happens during SlowSync.

Type

integer

$_server_add_count

$_server_add_count : integer

Number of objects that have been sent to the client for adding.

Type

integer

$_server_replace_count

$_server_replace_count : integer

Number of objects that have been sent to the client for replacement.

Type

integer

$_server_delete_count

$_server_delete_count : integer

Number of objects that have been sent to the client for deletion.

Type

integer

$_errors

$_errors : integer

Number of failed actions, for logging purposes only.

Type

integer

$_server_adds

$_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.

Type

array

$_server_replaces

$_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.

Type

array

$_server_deletes

$_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.

Type

array

$_server_task_adds

$_server_task_adds : array

List of task UIDs (in the keys) that have been added on the server since the last synchronization and are supposed to be sent to the client.

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.

Type

array

$_server_largeobj

$_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

Type

array

Methods

__construct()

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

Parameters

string $syncType
string $serverURI
string $clientURI
integer $serverAnchorLast
integer $serverAnchorNext
string $clientAnchorNext

handleClientSyncItem()

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.

Parameters

$output
\Horde_SyncMl_SyncElement $item

createSyncOutput()

createSyncOutput(  $output) 

Creates a <Sync> output containing the server changes.

Parameters

$output

handleFinal()

handleFinal(  $output,   $debug = false) 

Notifies the sync that a final has been received by the client.

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.

Parameters

$output
$debug

hasPendingElements()

hasPendingElements() 

Returns true if there are still outstanding server sync items to be sent to the client.

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

addSyncReceived()

addSyncReceived() 

getSyncsReceived()

getSyncsReceived() 

isComplete()

isComplete() 

closeSync()

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.

getServerLocURI()

getServerLocURI() 

getClientLocURI()

getClientLocURI() 

getClientAnchorNext()

getClientAnchorNext() 

getServerAnchorNext()

getServerAnchorNext() 

getServerAnchorLast()

getServerAnchorLast() 

createUidMap()

createUidMap(  $databaseURI,   $cuid,   $suid) 

Parameters

$databaseURI
$cuid
$suid

getServerChange()

getServerChange(string  $change, string  $id) : string

Returns the client ID of server change identified by the change type and server ID.

Parameters

string $change

The change type (add, replace, delete).

string $id

The object's server UID.

Returns

string —

The matching client ID or null if none found.

setServerChange()

setServerChange(string  $change, string  $sid, string  $cid) 

Sets the client ID of server change identified by the change type and server ID.

Parameters

string $change

The change type (add, replace, delete).

string $sid

The object's server UID.

string $cid

The object's client UID.

unsetServerChange()

unsetServerChange(string  $change, string  $id) 

Unsets the server-client-map of server change identified by the change type and server ID.

Parameters

string $change

The change type (add, replace, delete).

string $id

The object's server UID.

_retrieveChanges()

_retrieveChanges(string  $syncDB, array  $adds, array  $replaces, array  $deletes) 

Retrieves and condenses the changes on the server side since the last synchronization.

Parameters

string $syncDB

The database being synchronized.

array $adds

Will be set with the server-client-uid mappings of added objects.

array $replaces

Will be set with the server-client-uid mappings of changed objects.

array $deletes

Will be set with the server-client-uid mappings of deleted objects.

_taskToCalendar()

_taskToCalendar(  $databaseURI) 

Converts a calendar databaseURI to a tasks databaseURI for devices with handleTasksInCalendar.

Parameters

$databaseURI

_getServerLargeObjChunk()

_getServerLargeObjChunk(integer  $chunkLength) : string

Get the next chunk from the cached large object with maximum length of chunkLength or return false.

Parameters

integer $chunkLength

The maximum length of the chunk.

Returns

string —

The next chunk of the cached large object.