COLLECTION_CACHE
COLLECTION_CACHE
Collection names *
NoSQL based state management.
Collections used:
HAS_state: Holds sync state documents.
HAS_device: Holds device and device_user info.
HAS_map: Holds the incoming change (non-mail) map.
HAS_mailmap: Holds the incoming mail change map.
$_collection : array
The collection array for the collection we are currently syncing.
Keys include:
$_deviceInfo : \Horde_ActiveSync_Device
Device object.
__construct(array $params = array()) : \Horde_ActiveSync_State_Sql
Const'r
array | $params | Must contain:
|
setBackend(\Horde_ActiveSync_Driver_Base $backend) : void
Set the backend driver (should really only be called by a backend object when passing this object to client code)
\Horde_ActiveSync_Driver_Base | $backend | The backend driver |
isConflict(array $stat, string $type) : boolean
Determines if the server version of the message represented by $stat conflicts with the client version of the message. For this driver, this is true whenever $lastSyncTime is older then $stat['mod']. Method is only called from the Importer during an import of a non-new change from the client.
array | $stat | A message stat array |
string | $type | The type of change (change, delete, add) |
getFolderUidForBackendId(string $serverid) : string|boolean
Get a EAS Folder Uid for the given backend server id.
string | $serverid | The backend server id. E.g., 'INBOX'. |
The EAS UID for the requested serverid, or false if it is not found.
getChanges(array $options = array()) : array
Get all items that have changed since the last sync time
array | $options | An options array:
|
An array of hashes describing each change:
None found |
getNewSyncKeyWrapper(string $syncKey) : string
Non-static wrapper for getNewSyncKey.
string | $syncKey | The old syncKey |
The new synckey
todo |
Remove/replace in H6 with Horde_ActiveSync_SyncKey |
---|
checkCollision(string $syncKey) : boolean
Check for the (rare) possibility of a synckey collision between collections.
string | $syncKey | The synckey to check. |
True if there was a collision.
None found |
getNewSyncKey(string $syncKey) : string
Gets the new sync key for a specified sync key. You must save the new sync state under this sync key when done sync'ing by calling setNewSyncKey(), then save().
string | $syncKey | The old syncKey |
The new synckey
None found |
getSyncKeyCounter(string $syncKey) : mixed
Return the counter for the specified syncKey.
string | $syncKey | The synckey to obtain the counter for. |
integer|boolean The increment counter or false if failed.
None found |
getSyncKeyUid(string $syncKey) : string
Return the UID portion of a synckey.
string | $syncKey | The synckey |
The UID.
None found |
RowCmp( $a, $b) : \unknown_type
Helper function for the _diff method
$a | ||
$b |
None found |
loadState(array $collection, string $syncKey, string $type = null, string $id = null)
Load and initialize the sync state
array | $collection | The collection array for the collection, if a FOLDERSYNC, pass an empty array. |
string | $syncKey | The synckey of the state to load. If empty will force a reset of the state for the class specified in $id |
string | $type | The type of state a Horde_ActiveSync::REQUEST_TYPE constant. |
string | $id | The folder id this state represents. If empty assumed to be a foldersync state. |
Horde_ActiveSync_Exception_StateGone
None found |
getLatestSynckeyForCollection(string $collection_id) : string|integer
Return the most recently seen synckey for the given collection.
string | $collection_id | The activesync collection id. |
The synckey or 0 if none found.
None found |
updateSyncStamp()
Update the syncStamp in the collection state, outside of any other changes.
Used to prevent extremely large differences in syncStamps for clients and collections that don't often have changes.
None found |
updateState(string $type, array $change, integer $origin = \Horde_ActiveSync::CHANGE_ORIGIN_NA, string $user = null, string $clientid = '')
Update the state to reflect changes
Notes: If we are importing client changes, need to update the syncMapTable so we don't mirror back the changes on next sync. If we are exporting server changes, we need to track which changes have been sent (by removing them from $this->_changes) so we know which items to send on the next sync if a MOREAVAILBLE response was needed. If this is being called from a FOLDERSYNC command, update state accordingly.
string | $type | The type of change (change, delete, flags or foldersync) |
array | $change | A stat/change hash describing the change. Contains:
|
integer | $origin | Flag to indicate the origin of the change: Horde_ActiveSync::CHANGE_ORIGIN_NA - Not applicapble/not important Horde_ActiveSync::CHANGE_ORIGIN_PIM - Change originated from client |
string | $user | The current sync user, only needed if change origin is CHANGE_ORIGIN_PIM |
string | $clientid | client clientid sent when adding a new message. |
None found |
setPolicyKey(string $devId, integer $key)
Save a new device policy key to storage for the current user.
string | $devId | The device id |
integer | $key | The new policy key |
None found |
resetAllPolicyKeys()
Reset ALL device policy keys. Used when server policies have changed and you want to force ALL devices to pick up the changes. This will cause all devices that support provisioning to be reprovisioned.
None found |
setDeviceRWStatus(string $devId, string $status)
Set a new remotewipe status for the device
string | $devId | The device id. |
string | $status | A HordeActiveSync::RWSTATUS* constant. |
None found |
loadDeviceInfo(string $devId, string $user = null, array $params = array()) : \Horde_ActiveSync_Device
Load the device object.
string | $devId | The device id to obtain |
string | $user | The user to retrieve user-specific device info for |
array | $params | Additional parameters:
|
The device object
None found |
deviceExists(string $devId, string $user = null) : integer
Check that a given device id is known to the server. This is regardless of Provisioning status. If $user is provided, checks that the device is attached to the provided username.
string | $devId | The device id to check. |
string | $user | The device should be owned by this user. |
The numer of device entries found for the give devId, user combination. I.e., 0 == no device exists.
None found |
setDeviceInfo(\Horde_ActiveSync_Device $data, array $dirty = array())
Set new device info
\Horde_ActiveSync_Device | $data | The device information |
array | $dirty | Array of dirty properties. @since 2.9.0 |
None found |
setDeviceProperties(array $data, string $deviceId)
Set the device's properties as sent by a SETTINGS request.
array | $data | The device settings |
string | $deviceId | The device id. |
None found |
removeState(array $options)
Explicitly remove a state from storage.
array | $options | An options array containing at least one of:
|
None found |
listDevices(string $user = null, array $filter = array()) : array
List all devices that we know about.
string | $user | The username to list devices for. If empty, will return all devices. |
array | $filter | An array of optional filters where the keys are field names and the values are values to prefix-match. |
An array of device hashes
None found |
getLastSyncTimestamp(string $id = null, string $user = null) : integer
Get the last time the loaded device issued a SYNC request.
string | $id | The (optional) devivce id. If empty will use the currently loaded device. |
string | $user | The (optional) user id. If empty wil use the currently loaded device. |
The timestamp of the last sync, regardless of collection
None found |
getSyncCache(string $devid, string $user, array $fields = null) : array
Return the sync cache.
string | $devid | The device id. |
string | $user | The user id. |
array | $fields | An array of fields to return. Default is to return the full cache. @since 2.9.0 |
The current sync cache for the user/device combination.
None found |
saveSyncCache(array $cache, string $devid, string $user, array $dirty = array())
Save the provided sync_cache.
array | $cache | The cache to save. |
string | $devid | The device id. |
string | $user | The user id. |
array | $dirty | An array of dirty properties. @since 2.9.0 |
None found |
deleteSyncCache(string $devid, string $user = null)
Delete a complete sync cache
string | $devid | The device id |
string | $user | The user name. |
None found |
isDuplicatePIMAddition(string $id) : string
Check and see that we didn't already see the incoming change from the client.
This would happen e.g., if the client failed to receive the server response after successfully importing new messages.
string | $id | The client id sent during message addition. |
The UID for the given clientid, null if none found.
None found |
disconnect()
Close the underlying backend storage connection.
To be used during PING or looping SYNC operations.
None found |
updateServerIdInState(string $uid, string $serverid)
Update the serverid for a given folder uid in the folder's state object.
Needed when a folder is renamed on a client, but the UID must remain the same.
string | $uid | The folder UID. |
string | $serverid | The new serverid for this uid. |
since | 2.4.0 |
---|
_getFolderChanges()
Get folder changes. Populates $this->_changes with an array of change entries each containing 'type', 'id' and possibly 'flags'.
None found |
_getCutOffDate(integer $restrict) : integer
Returns the timestamp of the earliest modification time to consider
integer | $restrict | The time period to restrict to |
None found |
_getDiff(array $old, array $new) : \unknown_type
Helper function that performs the actual diff between client state and server state FOLDERSYNC arrays.
array | $old | The client state |
array | $new | The current server state |
None found |
_loadState()
Load the state represented by $syncKey from storage.
Horde_ActiveSync_Exception_StateGone
None found |
_havePIMChanges() : boolean
Check for the existence of ANY entries in the map table for this device and user.
An extra database query for each sync, but the payoff is that we avoid having to stat every message change we send to the client if there are no client generated changes for this sync period.
None found |
_getMailMapChanges(array $changes) : array
Return all available mailMap changes for the current folder.
array | $changes | The chagnes array |
An array of hashes, each in the form of {uid} => array( Horde_ActiveSync::CHANGE_TYPE_FLAGS => true|false, Horde_ActiveSync::CHANGE_TYPE_DELETE => true|false )
None found |
_loadStateFromResults(array $results)
Actually load the state data into the object from the query results.
array | $results | The results array from the state query. |
None found |
_checkCollision(\[type] $guid) : \[type]
\[type] | $guid | [description] |
[description]
todo |
---|
_resetDeviceState(string $id) : void
Reset the sync state for this device, for the specified collection.
string | $id | The collection to reset. |
None found |
_getPIMChangeTS(array $changes) : array
Return an array of timestamps from the map table for the last client-initiated change for the provided uid. Used to avoid mirroring back changes to the client that it sent to the server.
array | $changes | The changes array, containing 'id' and 'type'. |
An array of UID -> timestamp of the last client-initiated change for the specified uid, or null if none found.
None found |