PHP 클래스 Horde_ActiveSync_State_Sql, horde

Needs a number of SQL tables present: syncStateTable (horde_activesync_state): sync_timestamp: - The timestamp of last sync sync_key: - The syncKey for the last sync sync_pending: - If the last sync resulted in a MOREAVAILABLE, this contains a list of UIDs that still need to be sent to the client. sync_data: - Any state data that we need to track for the specific syncKey. Data such as current folder list on the client (for a FOLDERSYNC) and IMAP email UIDs (for Email collections during a SYNC). sync_devid: - The device id. sync_folderid:- The folder id for this sync. sync_user: - The user for this synckey. sync_mod: - The last modification stamp. syncMapTable (horde_activesync_map): message_uid - The server uid for the object sync_modtime - The time the change was received from the client 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 client 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_policykey - The provisioned policykey for this device/user combination.
저자: Michael J Rubinsky ([email protected])
상속: extends Horde_ActiveSync_State_Base
파일 보기 프로젝트 열기: horde/horde

보호된 프로퍼티들

프로퍼티 타입 설명
$_db Horde_Db_Adapter DB handle
$_syncCacheTable string The Synccache table. Holds the sync cache and is used to cache info about SYNC and PING request that are only sent a single time. Also stores data supported looping SYNC requests.
$_syncDeviceTable string Device information table. Holds information about each client.
$_syncMailMapTable string The Sync Mail Map table. Same principle as self::_syncMapTable, but for email collection data.
$_syncMapTable string The Sync Map table. This table temporarily holds information about changes received FROM the client and is used to prevent mirroring back changes to the client that originated there.
$_syncStateTable string State table name. This table holds the device's current state.
$_syncUsersTable string Users table. Holds information specific to a user.

공개 메소드들

메소드 설명
__construct ( array $params = [] ) : Horde_ActiveSync_State_Sql Const'r
connect ( ) (Re)open backend storage connection.
deleteSyncCache ( string $devid, string $user = null ) Delete a complete sync cache
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.
disconnect ( ) Close the underlying backend storage connection.
getLastSyncTimestamp ( string $id = null, string $user = null ) : integer Get the last time the loaded device issued a SYNC request.
getSyncCache ( string $devid, string $user, array $fields = null ) : array Return the sync cache.
isDuplicatePIMAddition ( string $id ) : string Check and see that we didn't already see the incoming change from the client.
isDuplicatePIMChange ( string $uid, string $synckey ) : boolean Check if the UID provided was altered during the SYNC_KEY provided.
listDevices ( string $user = null, array $filter = [] ) : array List all devices that we know about.
loadDeviceInfo ( string $devId, string $user = null, array $params = [] ) : Horde_ActiveSync_Device Load the device object.
removeState ( array $options ) Explicitly remove a state from storage.
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.
save ( ) Save the current state to storage
saveSyncCache ( array $cache, string $devid, string $user, array $dirty = [] ) Save the provided sync_cache.
setDeviceInfo ( Horde_ActiveSync_Device $data, array $dirty = [] ) Set new device info
setDeviceProperties ( array $data, string $deviceId ) Set the device's properties as sent by a SETTINGS request.
setDeviceRWStatus ( string $devId, string $status ) Set a new remotewipe status for the device
setPolicyKey ( string $devId, integer $key ) Save a new device policy key to storage.
updateServerIdInState ( string $uid, string $serverid ) Update the serverid for a given folder uid in the folder's state object.
updateState ( string $type, array $change, integer $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, string $user = null, string $clientid = '' ) Update the state to reflect changes
updateSyncStamp ( ) Update the syncStamp in the collection state, outside of any other changes.

보호된 메소드들

메소드 설명
_checkCollision ( string $guid ) : boolean Check for the (rare) possibility of a synckey collision between collections.
_gc ( string $syncKey ) Garbage collector - clean up from previous sync requests.
_getMailMapChanges ( array $changes ) : array Return all available mailMap changes for the current folder.
_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.
_havePIMChanges ( ) : boolean Check for the existence of ANY entries in the map table for this device and user.
_loadState ( ) Load the state represented by $syncKey from storage.
_loadStateFromResults ( array $results ) Actually load the state data into the object from the query results.
_resetDeviceState ( string $id ) : void Reset the sync state for this device, for the specified collection.

메소드 상세

__construct() 공개 메소드

Const'r
public __construct ( array $params = [] ) : Horde_ActiveSync_State_Sql
$params array Must contain: - db: (Horde_Db_Adapter_Base) The Horde_Db instance.
리턴 Horde_ActiveSync_State_Sql

_checkCollision() 보호된 메소드

Check for the (rare) possibility of a synckey collision between collections.
protected _checkCollision ( string $guid ) : boolean
$guid string The GUID portion of the synckey to check.
리턴 boolean true if there was a collision.

_gc() 보호된 메소드

Garbage collector - clean up from previous sync requests.
protected _gc ( string $syncKey )
$syncKey string The sync key

_getMailMapChanges() 보호된 메소드

Return all available mailMap changes for the current folder.
protected _getMailMapChanges ( array $changes ) : array
$changes array The changes array
리턴 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, Horde_ActiveSync::CHANGE_TYPE_DRAFT => true|false, )

_getPIMChangeTS() 보호된 메소드

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.
protected _getPIMChangeTS ( array $changes ) : array
$changes array The changes array, each entry a hash containing 'id' and 'type' keys.
리턴 array An array of UID -> timestamp of the last client-initiated change for the specified UIDs, or null if none found.

_havePIMChanges() 보호된 메소드

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.
protected _havePIMChanges ( ) : boolean
리턴 boolean

_loadState() 보호된 메소드

Load the state represented by $syncKey from storage.
protected _loadState ( )

_loadStateFromResults() 보호된 메소드

Actually load the state data into the object from the query results.
protected _loadStateFromResults ( array $results )
$results array The results array from the state query.

_resetDeviceState() 보호된 메소드

Reset the sync state for this device, for the specified collection.
protected _resetDeviceState ( string $id ) : void
$id string The collection to reset.
리턴 void

connect() 공개 메소드

(Re)open backend storage connection.
public connect ( )

deleteSyncCache() 공개 메소드

Delete a complete sync cache
public deleteSyncCache ( string $devid, string $user = null )
$devid string The device id
$user string The user name.

deviceExists() 공개 메소드

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.
public deviceExists ( string $devId, string $user = null ) : integer
$devId string The device id to check.
$user string The device should be owned by this user.
리턴 integer The numer of device entries found for the give devId, user combination. I.e., 0 == no device exists.

disconnect() 공개 메소드

To be used during PING or looping SYNC operations.
public disconnect ( )

getLastSyncTimestamp() 공개 메소드

Get the last time the loaded device issued a SYNC request.
public getLastSyncTimestamp ( string $id = null, string $user = null ) : integer
$id string The (optional) devivce id. If empty will use the currently loaded device.
$user string The (optional) user id. If empty wil use the currently loaded device.
리턴 integer The timestamp of the last sync, regardless of collection

getSyncCache() 공개 메소드

Return the sync cache.
public getSyncCache ( string $devid, string $user, array $fields = null ) : array
$devid string The device id.
$user string The user id.
$fields array An array of fields to return. Default is to return the full cache. @since 2.9.0
리턴 array The current sync cache for the user/device combination.

isDuplicatePIMAddition() 공개 메소드

This would happen e.g., if the client failed to receive the server response after successfully importing new messages.
public isDuplicatePIMAddition ( string $id ) : string
$id string The client id sent during message addition.
리턴 string The UID for the given clientid, null if none found.

isDuplicatePIMChange() 공개 메소드

Check if the UID provided was altered during the SYNC_KEY provided.
부터: 2.31.0
public isDuplicatePIMChange ( string $uid, string $synckey ) : boolean
$uid string The UID to check.
$synckey string The synckey to check.
리턴 boolean True if the provided UID was updated during the SYNC for the synckey provided.

listDevices() 공개 메소드

List all devices that we know about.
public listDevices ( string $user = null, array $filter = [] ) : array
$user string The username to list devices for. If empty, will return all devices.
$filter array An array of optional filters where the keys are field names and the values are values to match.
리턴 array An array of device hashes

loadDeviceInfo() 공개 메소드

Load the device object.
public loadDeviceInfo ( string $devId, string $user = null, array $params = [] ) : Horde_ActiveSync_Device
$devId string The device id to obtain
$user string The user to retrieve user-specific device info for
$params array Additional parameters: - force: (boolean) If true, reload the device info even if it's already loaded. Used to refresh values such as device_rwstatus that may have changed during a long running PING/SYNC. DEFAULT: false. @since 2.31.0
리턴 Horde_ActiveSync_Device The device object

removeState() 공개 메소드

Explicitly remove a state from storage.
public removeState ( array $options )
$options array An options array containing at least one of: - synckey: (string) Remove only the state associated with this synckey. DEFAULT: All synckeys are removed for the specified device. - devId: (string) Remove all information for this device. DEFAULT: None. If no device, a synckey is required. - user: (string) Restrict to removing data for this user only. DEFAULT: None - all users for the specified device are removed. - id: (string) When removing device state, restrict ro removing data only for this collection.

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.
public resetAllPolicyKeys ( )

save() 공개 메소드

Save the current state to storage
public save ( )

saveSyncCache() 공개 메소드

Save the provided sync_cache.
public saveSyncCache ( array $cache, string $devid, string $user, array $dirty = [] )
$cache array The cache to save.
$devid string The device id.
$user string The user id.
$dirty array An array of dirty properties. @since 2.9.0

setDeviceInfo() 공개 메소드

Set new device info
public setDeviceInfo ( Horde_ActiveSync_Device $data, array $dirty = [] )
$data Horde_ActiveSync_Device The device information
$dirty array Array of dirty properties. @since 2.9.0

setDeviceProperties() 공개 메소드

Set the device's properties as sent by a SETTINGS request.
public setDeviceProperties ( array $data, string $deviceId )
$data array The device settings
$deviceId string The device id.

setDeviceRWStatus() 공개 메소드

Set a new remotewipe status for the device
public setDeviceRWStatus ( string $devId, string $status )
$devId string The device id.
$status string A Horde_ActiveSync::RWSTATUS_* constant.

setPolicyKey() 공개 메소드

Save a new device policy key to storage.
public setPolicyKey ( string $devId, integer $key )
$devId string The device id
$key integer The new policy key

updateServerIdInState() 공개 메소드

Needed when a folder is renamed on a client, but the UID must remain the same.
부터: 2.4.0
public updateServerIdInState ( string $uid, string $serverid )
$uid string The folder UID.
$serverid string The new serverid for this uid.

updateState() 공개 메소드

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.
public updateState ( string $type, array $change, integer $origin = Horde_ActiveSync::CHANGE_ORIGIN_NA, string $user = null, string $clientid = '' )
$type string The type of change (change, delete, flags or foldersync)
$change array A stat/change hash describing the change. Contains: - id: (mixed) The message uid the change applies to. - serverid: (string) The backend server id for the folder. - folderuid: (string) The EAS folder UID for the folder. - parent: (string) The parent of the current folder, if any. - flags: (array) If this is a flag change, the state of the flags. - mod: (integer) The modtime of this change.
$origin integer 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
$user string The current sync user, only needed if change origin is CHANGE_ORIGIN_PIM
$clientid string client clientid sent when adding a new message

updateSyncStamp() 공개 메소드

Used to prevent extremely large differences in syncStamps for clients and collections that don't often have changes and the backend server doesn't keep separate syncStamp values per collection.
public updateSyncStamp ( )

프로퍼티 상세

$_db 보호되어 있는 프로퍼티

DB handle
protected Horde_Db_Adapter $_db
리턴 Horde_Db_Adapter

$_syncCacheTable 보호되어 있는 프로퍼티

The Synccache table. Holds the sync cache and is used to cache info about SYNC and PING request that are only sent a single time. Also stores data supported looping SYNC requests.
protected string $_syncCacheTable
리턴 string

$_syncDeviceTable 보호되어 있는 프로퍼티

Device information table. Holds information about each client.
protected string $_syncDeviceTable
리턴 string

$_syncMailMapTable 보호되어 있는 프로퍼티

The Sync Mail Map table. Same principle as self::_syncMapTable, but for email collection data.
protected string $_syncMailMapTable
리턴 string

$_syncMapTable 보호되어 있는 프로퍼티

The Sync Map table. This table temporarily holds information about changes received FROM the client and is used to prevent mirroring back changes to the client that originated there.
protected string $_syncMapTable
리턴 string

$_syncStateTable 보호되어 있는 프로퍼티

State table name. This table holds the device's current state.
protected string $_syncStateTable
리턴 string

$_syncUsersTable 보호되어 있는 프로퍼티

Users table. Holds information specific to a user.
protected string $_syncUsersTable
리턴 string