Overview

Packages

  • ActiveSync
  • None

Classes

  • Horde_ActiveSync_Message_Appointment
  • Horde_ActiveSync_Message_Attendee
  • Horde_ActiveSync_Message_Contact
  • Horde_ActiveSync_Message_Exception
  • Horde_ActiveSync_Message_Folder
  • Horde_ActiveSync_Message_Recurrence
  • Horde_ActiveSync_Message_Task
  • Horde_ActiveSync_State_Base
  • Horde_ActiveSync_State_History
  • Horde_ActiveSync_Timezone
  • Overview
  • Package
  • Class
  • Tree

Class Horde_ActiveSync_State_History

Horde_History based state management. Needs a number of SQL tables present:

syncStateTable (horde_activesync_state):
       sync_time:  timestamp of last sync
       sync_key:   the syncKey for the last sync
       sync_data:  If the last sync resulted in a MOREAVAILABLE, this contains
                   a list of UIDs that still need to be sent to the PIM.  If
                   this sync_key represents a FOLDERSYNC state, then this
                   contains the current folder state on the PIM.
       sync_devid: The device id.
       sync_folderid: The folder id for this sync.
       sync_user:     The user for this synckey

syncMapTable (horde_activesync_map):
       message_uid    - The server uid for the object
       sync_modtime   - The time the change was received from the PIM and
                        applied to the server data store.
       sync_key       - The syncKey that was current at the time the change
                        was received.
       sync_devid     - The device id this change was done on.
       sync_user      - The user that initiated the change.

   syncDeviceTable (horde_activesync_device):
       device_id      - The unique id for this device
       device_type    - The device type the PIM identifies itself with
       device_agent   - The user agent string sent by the device
       device_policykey  - The current policykey for this device
       device_rwstatus   - The current remote wipe status for this device

   syncUsersTable (horde_activesync_device_users):
       device_user    - A username attached to the device
       device_id      - The device id
       device_ping    - The account's ping state
       device_folders - Account's folder data

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

Horde_ActiveSync_State_Base
Extended by Horde_ActiveSync_State_History
Package: ActiveSync
Author: Michael J. Rubinsky mrubinsk@horde.org
Todo::

H5 This driver should be renamed to Horde_ActiveSync_State_Sql since the History related changes have been refactored out to a Core library.


Located at Horde/ActiveSync/State/History.php
Methods summary
public Horde_ActiveSync_StateMachine_File
# __construct( array $params = array() )

Const'r

Const'r

Parameters

$params
<p>Must contain: 'db' - Horde_Db 'syncStateTable' - Name of table for storing syncstate 'syncDeviceTable' - Name of table for storing device and ping data 'syncMapTable' - Name of table for remembering what changes are due to PIM import so we don't mirror the changes back to the PIM on next Sync 'syncUsersTable' - Name of table for mapping users to devices.</p>

Returns

Horde_ActiveSync_StateMachine_File

Overrides

Horde_ActiveSync_State_Base::__construct()
public
# loadState( string $syncKey, string $type = null, string $id = null )

Load the sync state

Load the sync state

Parameters

$syncKey
<p>The synckey of the state to load. If empty will force a reset of the state for the class specified in $id</p>
$type
<p>$id The folder id this state represents. If empty assumed to be a foldersync state.</p>
$id
The collection id this represents

Throws

Horde_ActiveSync_Exception

Prarm

string $type The type of state (sync, foldersync).
public boolean
# isConflict( array $stat, string $type )

Determines if the server version of the message represented by $stat conflicts with the PIM 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 PIM.

Determines if the server version of the message represented by $stat conflicts with the PIM 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 PIM.

Parameters

$stat
A message stat array
$type
The type of change (change, delete, add)

Returns

boolean

See

Horde_ActiveSync_State_Base::isConflict()
public
# save( )

Save the current state to storage

Save the current state to storage

Throws

Horde_ActiveSync_Exception
public
# updateState( string $type, array $change, integer $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, string $user = null, string $clientid = '' )

Update the state to reflect changes

Update the state to reflect changes

Notes: If we are importing PIM 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. Yet another reason to break out state handling into different classes based on the command being run (Horde_ActiveSync_State_Sync, *_FolderSync, *_Ping etc...);

Parameters

$type
<p>The type of change (change, delete, flags or foldersync)</p>
$change
A stat/change hash describing the change
$origin
Flag to indicate the origin of the change.
$user
<p>The current sync user, only needed if change origin is CHANGE_ORIGIN_PIM</p>
$clientid
PIM clientid sent when adding a new message
public boolean
# setFolderData( object $device, array $folders )

Save folder data for a specific device. This is needed for BC with older activesync versions that use GETHIERARCHY requests to get the folder info instead of maintaining the folder state with FOLDERSYNC requests.

Save folder data for a specific device. This is needed for BC with older activesync versions that use GETHIERARCHY requests to get the folder info instead of maintaining the folder state with FOLDERSYNC requests.

Parameters

$device
The device object
$folders
The folder data

Returns

boolean

Throws

Horde_ActiveSync_Exception
public mixed
# getFolderData( object $device, string $class )

Get the folder data for a specific device

Get the folder data for a specific device

Parameters

$device
The device object
$class
The folder class to fetch (Calendar, Contacts etc.)

Returns

mixed
Either an array of folder data || false
public array
# getKnownFolders( )

Return an array of known folders. This is essentially the state for a FOLDERSYNC request. AS uses a seperate synckey for FOLDERSYNC requests also, so need to treat it as any other collection.

Return an array of known folders. This is essentially the state for a FOLDERSYNC request. AS uses a seperate synckey for FOLDERSYNC requests also, so need to treat it as any other collection.

Returns

array
public The
# initPingState( string $device )

Perform any initialization needed to deal with pingStates for this driver

Perform any initialization needed to deal with pingStates for this driver

Parameters

$device
$devId The device id to load pingState for

Returns

The
$collection array
public StdClass
# loadDeviceInfo( string $devId, string $user )

Obtain the device object. For this driver, we also store the PING data in the device table.

Obtain the device object. For this driver, we also store the PING data in the device table.

Parameters

$devId
The device id to obtain
$user
The user to retrieve user-specific device info for

Returns

StdClass
The device obejct

Throws

Horde_ActiveSync_Exception
public boolean
# setDeviceInfo( object $data )

Set new device info

Set new device info

Parameters

$data
The device information

Returns

boolean
public boolean
# deviceExists( string $devId, string $user = null )

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.

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.

Parameters

$devId
The device id to check.
$user
The device should be owned by this user.

Returns

boolean
public array
# listDevices( mixed $user = null )

List all devices that we know about.

List all devices that we know about.

Returns

array
An array of device hashes

Throws

Horde_ActiveSync_Exception
public integer
# getLastSyncTimestamp( )

Get the last time the loaded device issued a SYNC request.

Get the last time the loaded device issued a SYNC request.

Returns

integer
The timestamp of the last sync, regardless of collection

Throws

Horde_ActiveSync_Exception
public
# addPingCollections( array $collections )

Add a collection to the PING state. Ping state must already be loaded.

Add a collection to the PING state. Ping state must already be loaded.

Parameters

$collections
<p>An array of collection information to replace any existing cached ping collection state.</p>
public
# loadPingCollectionState( array $pingCollection )

Load a specific collection's ping state. Ping state must already have been loaded.

Load a specific collection's ping state. Ping state must already have been loaded.

Parameters

$pingCollection
The collection array from the PIM request

Throws

Horde_ActiveSync_Exception,

Horde_ActiveSync_Exception_StateGone, Horde_ActiveSync_Exception_InvalidRequest

public boolean
# savePingState( )

Save the current ping state to storage

Save the current ping state to storage

Returns

boolean

Throws

Horde_ActiveSync_Exception
public integer
# getHeartbeatInterval( )

Return the heartbeat interval, or zero if we have no existing state

Return the heartbeat interval, or zero if we have no existing state

Returns

integer
The hearbeat interval, or zero if not found.

Throws

Horde_ActiveSync_Exception
public
# setHeartbeatInterval( integer $lifetime )

Set the device's heartbeat interval

Set the device's heartbeat interval

Parameters

$lifetime
public array
# getChanges( integer $flags = 0 )

Get all items that have changed since the last sync time

Get all items that have changed since the last sync time

Parameters

$flags

Returns

array
public
# setPolicyKey( string $devId, integer $key )

Save a new device policy key to storage.

Save a new device policy key to storage.

Parameters

$devId
The device id
$key
The new policy key
public
# 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.

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.

Throws

Horde_ActiveSync_Exception
public boolean
# setDeviceRWStatus( string $devId, string $status )

Set a new remotewipe status for the device

Set a new remotewipe status for the device

Parameters

$devId
$status

Returns

boolean

Throws

Horde_ActiveSync_Exception
public
# removeState( string $synckey = null, string $devId = null, string $user = null )

Explicitly remove a state from storage.

Explicitly remove a state from storage.

Parameters

$synckey
The specific state to remove
$devId
Remove all information for this device.
$user
<p>When removing device info, restrict to removing data for this user only.</p>

Throws

Horde_ActiveSyncException
public string
# isDuplicatePIMAddition( string $id )

Check and see that we didn't already see the incoming change from the PIM. This would happen e.g., if the PIM failed to receive the server response after successfully importing new messages.

Check and see that we didn't already see the incoming change from the PIM. This would happen e.g., if the PIM failed to receive the server response after successfully importing new messages.

Parameters

$id
The client id sent during message addition.

Returns

string
The UID for the given clientid, null if none found.

Throws

Horde_ActiveSync_Exception
Methods inherited from Horde_ActiveSync_State_Base
RowCmp(), __destruct(), generatePolicyKey(), getChangeCount(), getCurrentSyncKey(), getDeviceRWStatus(), getNewSyncKey(), getPolicyKey(), getSyncKeyCounter(), init(), resetPingState(), setBackend(), setLogger(), setNewSyncKey()
Constants inherited from Horde_ActiveSync_State_Base
FILTERTYPE_1DAY, FILTERTYPE_1MONTH, FILTERTYPE_1WEEK, FILTERTYPE_2WEEKS, FILTERTYPE_3DAYS, FILTERTYPE_3MONTHS, FILTERTYPE_6MONTHS, FILTERTYPE_ALL
API documentation generated by ApiGen