PHP 클래스 Horde_ActiveSync_State_Base, horde

저자: Michael J Rubinsky ([email protected])
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_backend The backend driver
$_changes array (Will remain null until getChanges() is called)
$_collection array Keys include: - class: The collection class Contacts, Calendar etc... - synckey: The current synckey - newsynckey: The new synckey sent back to the client - id: Server folder id - filtertype: Filter - conflict: Conflicts - truncation: Truncation
$_deviceInfo Horde_ActiveSync_Device Device object.
$_folder Caches the current state(s) in memory
$_folderUidMap array A map of backend folderids to UIDs
$_lastSyncStamp timestamp The timestamp for the last syncKey
$_logger Horde_Log_Logger Logger instance
$_params array Configuration parameters
$_procid integer The process id (used for logging).
$_syncKey string The syncKey for the current request.
$_thisSyncStamp timestamp The current sync timestamp
$_type string The type of request we are handling.

공개 메소드들

메소드 설명
RowCmp ( $a, $b ) : unknown_type Helper function for the _diff method
__construct ( array $params = [] ) Const'r
checkCollision ( string $syncKey ) : boolean Check for the (rare) possibility of a synckey collision between collections.
connect ( ) (Re)open backend storage connection.
deleteSyncCache ( string $devid, string $user ) Delete a complete sync cache
deviceExists ( string $devId, string $user = null ) : boolean Check that a given device id is known to the server. This is regardless of Provisioning status.
disconnect ( ) Close the underlying backend storage connection.
generatePolicyKey ( ) : integer Generate a random 10 digit policy key
getChangeCount ( ) : integer Get the number of server changes.
getChanges ( array $options = [] ) : array Get all items that have changed since the last sync time
getCurrentSyncKey ( ) : string Get the current synckey
getDeviceRWStatus ( string $devId, boolean $refresh = false ) : integer Return a device wipe status
getFolderUidForBackendId ( string $serverid ) : string | boolean Get a EAS Folder Uid for the given backend server id.
getFolderUidToBackendIdMap ( ) : array Return the mapping of folder uids to backend folderids.
getKnownFolders ( ) : array 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.
getLastSyncTimestamp ( ) : integer Get the last time the currently loaded device issued a SYNC request.
getLatestSynckeyForCollection ( string $collection_id ) : string | integer Return the most recently seen synckey for the given collection.
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().
getNewSyncKeyWrapper ( string $syncKey ) : string Non-static wrapper for getNewSyncKey.
getPolicyKey ( string $devId ) : integer Obtain the current policy key, if it exists.
getSyncCache ( string $devid, string $user, array $fields = null ) : array Return the sync cache.
getSyncKeyCounter ( string $syncKey ) : mixed Return the counter for the specified syncKey.
getSyncKeyUid ( string $syncKey ) : string Return the UID portion of a synckey.
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.
isDuplicatePIMAddition ( string $id ) : string Check and see that we didn't already see the incoming change from the client.
listDevices ( ) : array List all devices that we know about.
loadDeviceInfo ( $device, string $user = null, array $params = [] ) : Horde_ActiveSync_Device Obtain the device object.
loadState ( array $collection, string $syncKey, string $type = null, string $id = null ) Load and initialize the sync state
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 syncstate to storage
saveSyncCache ( array $cache, string $devid, string $user, array $dirty = [] ) Save the provided sync_cache.
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)
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
setLogger ( Horde_Log_Logger $logger ) Set the logger instance for this object.
setNewSyncKey ( string $newKey ) Update the $oldKey syncState to $newKey.
setPolicyKey ( string $devId, integer $key ) Save a new device policy key to storage.
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.

보호된 메소드들

메소드 설명
_getCutOffDate ( integer $restrict ) : integer Returns the timestamp of the earliest modification time to consider
_getDiff ( array $old, array $new ) : unknown_type Helper function that performs the actual diff between client state and server state FOLDERSYNC arrays.
_getFolderChanges ( ) Get folder changes. Populates $this->_changes with an array of change entries each containing 'type', 'id' and possibly 'flags'.
_getMailMapChanges ( array $changes ) : array Return all available mailMap changes for the current folder.
_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.

메소드 상세

RowCmp() 공개 정적인 메소드

Helper function for the _diff method
public static RowCmp ( $a, $b ) : unknown_type
$a
$b
리턴 unknown_type

__construct() 공개 메소드

Const'r
public __construct ( array $params = [] )
$params array All configuration parameters.

_getCutOffDate() 보호된 정적인 메소드

Returns the timestamp of the earliest modification time to consider
protected static _getCutOffDate ( integer $restrict ) : integer
$restrict integer The time period to restrict to
리턴 integer

_getDiff() 보호된 메소드

Helper function that performs the actual diff between client state and server state FOLDERSYNC arrays.
protected _getDiff ( array $old, array $new ) : unknown_type
$old array The client state
$new array The current server state
리턴 unknown_type

_getFolderChanges() 보호된 메소드

Get folder changes. Populates $this->_changes with an array of change entries each containing 'type', 'id' and possibly 'flags'.
protected _getFolderChanges ( )

_getMailMapChanges() 보호된 메소드

Return all available mailMap changes for the current folder.
protected _getMailMapChanges ( array $changes ) : array
$changes array The chagnes 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 )

_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 ( )

checkCollision() 공개 메소드

Check for the (rare) possibility of a synckey collision between collections.
public checkCollision ( string $syncKey ) : boolean
$syncKey string The synckey to check.
리턴 boolean True if there was a collision.

connect() 추상적인 공개 메소드

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

deleteSyncCache() 추상적인 공개 메소드

Delete a complete sync cache
abstract public deleteSyncCache ( string $devid, string $user )
$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.
abstract public deviceExists ( string $devId, string $user = null ) : boolean
$devId string The device id to check
$user string The device should be owned by this user.
리턴 boolean

disconnect() 추상적인 공개 메소드

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

generatePolicyKey() 공개 메소드

Generate a random 10 digit policy key
public generatePolicyKey ( ) : integer
리턴 integer

getChangeCount() 공개 메소드

Get the number of server changes.
public getChangeCount ( ) : integer
리턴 integer

getChanges() 공개 메소드

Get all items that have changed since the last sync time
public getChanges ( array $options = [] ) : array
$options array An options array: - ping: (boolean) Only detect if there is a change, do not build any messages. DEFAULT: false (Build full change array).
리턴 array An array of hashes describing each change: - id: The id of the item being changed. - type: The type of change. a Horde_ActiveSync::CHANGE_TYPE_* constant. - flags: Used to transport email message flags when type is Horde_ActiveSync::CHANGE_TYPE_FLAGS or set to Horde_ActiveSync::FLAG_NEWMESSAGE when type is Horde_ActiveSync::CHANGE_TYPE_CHANGE and the message represents a new message, as opposed to a change in an existing message. - ignore: Set to true when the change should be ignored, and not sent to the client by the exporter. Usually due to the change being the result of a client originated change.

getCurrentSyncKey() 공개 메소드

Get the current synckey
public getCurrentSyncKey ( ) : string
리턴 string The synkey we last retrieved state for

getDeviceRWStatus() 공개 메소드

Return a device wipe status
public getDeviceRWStatus ( string $devId, boolean $refresh = false ) : integer
$devId string
$refresh boolean If true, reload the device's rwstatus flag. @since 2.31.0
리턴 integer

getFolderUidForBackendId() 공개 메소드

Get a EAS Folder Uid for the given backend server id.
사용 중단: Use self::getFolderUidToBackendIdMap() instead.
부터: 2.4.0
public getFolderUidForBackendId ( string $serverid ) : string | boolean
$serverid string The backend server id. E.g., 'INBOX'.
리턴 string | boolean The EAS UID for the requested serverid, or false if it is not found.

getFolderUidToBackendIdMap() 공개 메소드

Return the mapping of folder uids to backend folderids.
부터: 2.9.0
public getFolderUidToBackendIdMap ( ) : array
리턴 array An array of backend folderids -> uids.

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.
public getKnownFolders ( ) : array
리턴 array An array of folder uids.

getLastSyncTimestamp() 추상적인 공개 메소드

Get the last time the currently loaded device issued a SYNC request.
abstract public getLastSyncTimestamp ( ) : integer
리턴 integer The timestamp of the last sync, regardless of collection

getLatestSynckeyForCollection() 공개 메소드

Return the most recently seen synckey for the given collection.
public getLatestSynckeyForCollection ( string $collection_id ) : string | integer
$collection_id string The activesync collection id.
리턴 string | integer The synckey or 0 if none found.

getNewSyncKey() 공개 정적인 메소드

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().
public static getNewSyncKey ( string $syncKey ) : string
$syncKey string The old syncKey
리턴 string The new synckey

getNewSyncKeyWrapper() 공개 메소드

Non-static wrapper for getNewSyncKey.
public getNewSyncKeyWrapper ( string $syncKey ) : string
$syncKey string The old syncKey
리턴 string The new synckey

getPolicyKey() 공개 메소드

Obtain the current policy key, if it exists.
public getPolicyKey ( string $devId ) : integer
$devId string The device id to obtain policy key for.
리턴 integer The current policy key for this device, or 0 if none exists.

getSyncCache() 추상적인 공개 메소드

Return the sync cache.
abstract 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.

getSyncKeyCounter() 공개 정적인 메소드

Return the counter for the specified syncKey.
public static getSyncKeyCounter ( string $syncKey ) : mixed
$syncKey string The synckey to obtain the counter for.
리턴 mixed integer|boolean The increment counter or false if failed.

getSyncKeyUid() 공개 정적인 메소드

Return the UID portion of a synckey.
public static getSyncKeyUid ( string $syncKey ) : string
$syncKey string The synckey
리턴 string The UID.

isConflict() 공개 메소드

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.
public isConflict ( array $stat, string $type ) : boolean
$stat array A message stat array
$type string The type of change (change, delete, add)
리턴 boolean

isDuplicatePIMAddition() 추상적인 공개 메소드

This would happen e.g., if the client failed to receive the server response after successfully importing new messages.
abstract 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.

listDevices() 추상적인 공개 메소드

List all devices that we know about.
abstract public listDevices ( ) : array
리턴 array An array of device hashes

loadDeviceInfo() 추상적인 공개 메소드

Obtain the device object.
abstract public loadDeviceInfo ( $device, string $user = null, array $params = [] ) : Horde_ActiveSync_Device
$user string
$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

loadState() 공개 메소드

Load and initialize the sync state
public loadState ( array $collection, string $syncKey, string $type = null, string $id = null )
$collection array The collection array for the collection, if a FOLDERSYNC, pass an empty array.
$syncKey string The synckey of the state to load. If empty will force a reset of the state for the class specified in $id
$type string The type of state a Horde_ActiveSync::REQUEST_TYPE constant.
$id string The folder id this state represents. If empty assumed to be a foldersync state.

removeState() 추상적인 공개 메소드

Explicitly remove a state from storage.
abstract public removeState ( array $options )
$options array An options array containing: - synckey: (string) Remove only the state associated with this synckey. - devId: (string) Remove all information for this device. - user: (string) When removing device info, restrict to removing data for this user only. - 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.
abstract public resetAllPolicyKeys ( )

save() 추상적인 공개 메소드

Save the current syncstate to storage
abstract public save ( )

saveSyncCache() 추상적인 공개 메소드

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

setBackend() 공개 메소드

Set the backend driver (should really only be called by a backend object when passing this object to client code)
public setBackend ( Horde_ActiveSync_Driver_Base $backend ) : void
$backend Horde_ActiveSync_Driver_Base The backend driver
리턴 void

setDeviceInfo() 추상적인 공개 메소드

Set new device info
abstract 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.
abstract 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
abstract public setDeviceRWStatus ( string $devId, string $status )
$devId string The device id.
$status string A Horde_ActiveSync::RWSTATUS_* constant.

setLogger() 공개 메소드

Set the logger instance for this object.
public setLogger ( Horde_Log_Logger $logger )
$logger Horde_Log_Logger

setNewSyncKey() 공개 메소드

Update the $oldKey syncState to $newKey.
public setNewSyncKey ( string $newKey )
$newKey string

setPolicyKey() 추상적인 공개 메소드

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

updateState() 추상적인 공개 메소드

Update the state to reflect changes
abstract 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: The message uid the change applies to - parent: The parent of the message, normally the folder id. - flags: If this is a flag change, the state of the read flag. - mod: The modtime of this change for collections that use it.
$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.
public updateSyncStamp ( )

프로퍼티 상세

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

The backend driver
protected $_backend

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

(Will remain null until getChanges() is called)
protected array $_changes
리턴 array

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

Keys include: - class: The collection class Contacts, Calendar etc... - synckey: The current synckey - newsynckey: The new synckey sent back to the client - id: Server folder id - filtertype: Filter - conflict: Conflicts - truncation: Truncation
protected array $_collection
리턴 array

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

Device object.
protected Horde_ActiveSync_Device $_deviceInfo
리턴 Horde_ActiveSync_Device

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

Caches the current state(s) in memory
protected $_folder

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

A map of backend folderids to UIDs
protected array $_folderUidMap
리턴 array

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

The timestamp for the last syncKey
protected timestamp $_lastSyncStamp
리턴 timestamp

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

Logger instance
protected Horde_Log_Logger $_logger
리턴 Horde_Log_Logger

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

Configuration parameters
protected array $_params
리턴 array

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

The process id (used for logging).
protected int $_procid
리턴 integer

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

The syncKey for the current request.
protected string $_syncKey
리턴 string

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

The current sync timestamp
protected timestamp $_thisSyncStamp
리턴 timestamp

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

The type of request we are handling.
protected string $_type
리턴 string