PHP Class Horde_ActiveSync_Collections, horde

Author: Michael J Rubinsky ([email protected])
Inheritance: implements IteratorAggregate
Datei anzeigen Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_as Horde_ActiveSync The ActiveSync server object.
$_cache Horde_ActiveSync_SyncCache The syncCache
$_changedCollections array Cache of collections that have had changes detected.
$_changes array Cache of changes.
$_collections array The collection data
$_globalWindowSize integer Global WINDOWSIZE Defaults to 100 (MS-ASCMD 2.2.3.188)
$_hangingSync boolean Flag to indicate the client is requesting a hanging SYNC.
$_importedChanges boolean Imported changes flag.
$_logger Horde_Log_Logger The logger
$_procid integer Cache the process id for logging.
$_shortSyncRequest boolean Short sync request flag.
$_synckeyCount integer Count of available synckeys
$_tempSyncCache Horde_ActiveSync_SyncCache Cache a temporary syncCache.
$_unchangedCount integer Count of unchanged collections calculated for PARTIAL sync.
$_windowsizeOverride boolean Flag to indicate we have overridden the globalWindowSize

Public Methods

Method Description
__call ( $method, $parameters ) Magic.
__construct ( Horde_ActiveSync_SyncCache $cache, Horde_ActiveSync $as ) Const'r
__get ( $property ) Property getter
__set ( $property, $value ) Property setter.
addCollection ( array $collection, boolean $requireSyncKey = false ) Add a new populated collection array to the sync cache.
cachedCollectionCount ( ) : integer Return the count of collections in the cache only.
canDoLoopingSync ( ) : boolean Return whether or not we want a looping sync. We can do a looping sync if we have no imported changes AND we have either a hbinterval, wait, or a shortSync.
canSendEmptyResponse ( ) : boolean Return if we can do an empty response
checkFilterType ( string $id, string $filter ) : boolean Check for an update FILTERTYPE
checkStaleRequest ( ) : boolean Return if the current looping sync is stale. A stale looping sync is one which has begun earlier than the most recently running sync reported by the syncCache.
collectionCount ( ) : integer Return the count of available collections.
deleteFolderFromHierarchy ( $uid ) Delete a folder from the hierarchy cache.
ensureOptions ( ) Ensure default OPTIONS values are populated, while not overwriting any existing values.
getBackendIdForFolderUid ( $folderid ) : string Translate an EAS folder uid into a backend serverid.
getChangesFlag ( string $collection_id ) : boolean Get the getchanges flag on the specified collection.
getCollectionChangeCount ( boolean $ping = false ) : integer Return the count of the current collection's chagnes.
getCollectionChanges ( boolean $ping = false, array $ensure = [] ) : array Return any changes for the current collection.
getCollectionClass ( string $id ) : string | boolean Return a collection class given the collection id.
getCollectionType ( $id )
getDefaultWindowSize ( )
getFolderUidForBackendId ( string $folderid ) : string Translate a backend id E.g., INBOX into an EAS folder uid.
getHeartbeat ( ) : integer | boolean Return the heartbeat interval. Always returned as the heartbeat (seconds) not wait interval (minutes).
getHierarchyChanges ( ) : array Return all know hierarchy changes.
getIterator ( ) Iterator
getNewCollection ( ) : array Get a new collection array, populated with default values.
haveHierarchy ( ) : boolean Return if we have a current folder hierarchy.
havePingableCollections ( ) : boolean Check if we have any pingable collections.
haveSyncableCollections ( long $version ) : boolean Determine if we have any syncable collections either locally or in the sync cache.
initCollectionState ( array &$collection, boolean $requireSyncKey = false ) Attempt to initialize the sync state.
initEmptySync ( ) : boolean Prepare the syncCache for an EMPTY sync request.
initFullSync ( ) Prepares the syncCache for a full sync request.
initHierarchySync ( string $synckey ) : array Prepare for a hierarchy sync.
initPartialSync ( ) : boolean Prepares the syncCache for a partial sync request and checks that it is allowed.
loadCollectionsFromCache ( ) Load all the collections we know about from the cache.
pollForChanges ( integer $heartbeat, integer $interval, array $options = [] ) : boolean | integer Poll the backend for changes.
resetPingCache ( ) Force reset all collection's PINGABLE flag. Used to force client to issue a non-empty PING request.
save ( boolean $preserve_folders = false ) Save the syncCache to storage.
setDefaultWindowSize ( integer $window, boolean $override = false ) Sets the default WINDOWSIZE.
setGetChangesFlag ( string $collection_id ) Set the getchanges flag on the specified collection.
setHeartbeat ( array $hb ) Set the looping sync heartbeat values.
updateCache ( ) Update the syncCache with current collection data.
updateCollectionsFromCache ( ) Updates data from the cache for collectons that are already loaded. Used to ensure looping SYNC and PING requests are operating on the most recent syncKey.
updateFolderinHierarchy ( Horde_ActiveSync_Message_Folder $folder, boolean $update = false ) Update/Add a folder in the hierarchy cache.
updateHierarchyKey ( string $key ) Update the hierarchy synckey in the cache.
updatePingableFlag ( ) Marks all loaded collections with a synckey as pingable.
validateFromCache ( ) Validates the collection data from the syncCache, filling in missing values from the folder cache.
validateHierarchyChanges ( Horde_ActiveSync_Connector_Exporter_FolderSync $exporter, array $seenFolders ) Validate and perform some sanity checks on the hierarchy changes before being sent to the client.

Protected Methods

Method Description
_checkConfirmedKeys ( )
_getMissingCollectionsFromCache ( ) Populate the collections data with missing data from the syncCache during a PARTIAL SYNC.
_haveNoChangesInPartialSync ( ) : boolean Return if we have no changes to collection options, but have requested a partial sync. A partial sync must have either a wait, hbinterval, or some subset of collections to be valid.
_sleep ( integer $interval ) Wait for specified interval, and close any backend connections while we wait.

Method Details

__call() public method

..
public __call ( $method, $parameters )

__construct() public method

Const'r
public __construct ( Horde_ActiveSync_SyncCache $cache, Horde_ActiveSync $as )
$cache Horde_ActiveSync_SyncCache The SyncCache.
$as Horde_ActiveSync The ActiveSync server object.

__get() public method

Property getter
public __get ( $property )

__set() public method

Property setter.
public __set ( $property, $value )

_checkConfirmedKeys() protected method

protected _checkConfirmedKeys ( )

_getMissingCollectionsFromCache() protected method

Populate the collections data with missing data from the syncCache during a PARTIAL SYNC.

_haveNoChangesInPartialSync() protected method

Return if we have no changes to collection options, but have requested a partial sync. A partial sync must have either a wait, hbinterval, or some subset of collections to be valid.

_sleep() protected method

Wait for specified interval, and close any backend connections while we wait.
protected _sleep ( integer $interval )
$interval integer The number of seconds to sleep.

addCollection() public method

Add a new populated collection array to the sync cache.
public addCollection ( array $collection, boolean $requireSyncKey = false )
$collection array The collection array.
$requireSyncKey boolean Attempt to read missing synckey from cache if true. If not found, set to 0.

cachedCollectionCount() public method

Return the count of collections in the cache only.
public cachedCollectionCount ( ) : integer
return integer

canDoLoopingSync() public method

Return whether or not we want a looping sync. We can do a looping sync if we have no imported changes AND we have either a hbinterval, wait, or a shortSync.
public canDoLoopingSync ( ) : boolean
return boolean True if we want a looping sync, false otherwise.

canSendEmptyResponse() public method

Return if we can do an empty response
public canSendEmptyResponse ( ) : boolean
return boolean

checkFilterType() public method

Check for an update FILTERTYPE
public checkFilterType ( string $id, string $filter ) : boolean
$id string The collection id to check
$filter string The new filter value.
return boolean True if filtertype passed, false if it has changed.

checkStaleRequest() public method

Return if the current looping sync is stale. A stale looping sync is one which has begun earlier than the most recently running sync reported by the syncCache.
public checkStaleRequest ( ) : boolean
return boolean True if the current looping sync is stale. False otherwise.

collectionCount() public method

Return the count of available collections.
public collectionCount ( ) : integer
return integer

deleteFolderFromHierarchy() public method

Delete a folder from the hierarchy cache.
public deleteFolderFromHierarchy ( $uid )

ensureOptions() public method

Ensure default OPTIONS values are populated, while not overwriting any existing values.
Since: 2.20.0
public ensureOptions ( )

getBackendIdForFolderUid() public method

Translate an EAS folder uid into a backend serverid.
public getBackendIdForFolderUid ( $folderid ) : string
return string The backend server id.

getChangesFlag() public method

Get the getchanges flag on the specified collection.
public getChangesFlag ( string $collection_id ) : boolean
$collection_id string The collection id.
return boolean

getCollectionChangeCount() public method

Return the count of the current collection's chagnes.
public getCollectionChangeCount ( boolean $ping = false ) : integer
$ping boolean Only ping the collection if true.
return integer The change count.

getCollectionChanges() public method

Return any changes for the current collection.
public getCollectionChanges ( boolean $ping = false, array $ensure = [] ) : array
$ping boolean True if this is a PING request, false otherwise. If true, we only detect that a change has occured, not the data on all of the changes.
$ensure array An array of UIDs that should be sent in the current response if possible, and not put off because of a MOREAVAILABLE situation. @deprecated and no longer used.
return array The changes array.

getCollectionClass() public method

Return a collection class given the collection id.
public getCollectionClass ( string $id ) : string | boolean
$id string The collection id.
return string | boolean The collection class or false if not found.

getCollectionType() public method

public getCollectionType ( $id )

getDefaultWindowSize() public method

getFolderUidForBackendId() public method

Translate a backend id E.g., INBOX into an EAS folder uid.
public getFolderUidForBackendId ( string $folderid ) : string
$folderid string The backend id.
return string The EAS uid.

getHeartbeat() public method

Return the heartbeat interval. Always returned as the heartbeat (seconds) not wait interval (minutes).
public getHeartbeat ( ) : integer | boolean
return integer | boolean The number of seconds in a heartbeat, or false if no heartbeat set.

getHierarchyChanges() public method

Return all know hierarchy changes.
public getHierarchyChanges ( ) : array
return array An array of changes.

getIterator() public method

Iterator
public getIterator ( )

getNewCollection() public method

Get a new collection array, populated with default values.
public getNewCollection ( ) : array
return array

haveHierarchy() public method

Return if we have a current folder hierarchy.
public haveHierarchy ( ) : boolean
return boolean

havePingableCollections() public method

Check if we have any pingable collections.
public havePingableCollections ( ) : boolean
return boolean True if we have collections marked as pingable.

haveSyncableCollections() public method

Determine if we have any syncable collections either locally or in the sync cache.
public haveSyncableCollections ( long $version ) : boolean
$version long The EAS version
return boolean

initCollectionState() public method

Attempt to initialize the sync state.
public initCollectionState ( array &$collection, boolean $requireSyncKey = false )
$collection array The collection array.
$requireSyncKey boolean Require collection to have a synckey and throw exception if it's not present.

initEmptySync() public method

Prepare the syncCache for an EMPTY sync request.
Since: 2.25.0
public initEmptySync ( ) : boolean
return boolean False if EMPTY request cannot be performed, otherwise true.

initFullSync() public method

Prepares the syncCache for a full sync request.
public initFullSync ( )

initHierarchySync() public method

Prepare for a hierarchy sync.
public initHierarchySync ( string $synckey ) : array
$synckey string The current synckey from the client.
return array An array of known folders.

initPartialSync() public method

MS-ASCMD 2.2.3.124
public initPartialSync ( ) : boolean
return boolean True if parital sync is possible, false otherwise.

loadCollectionsFromCache() public method

Load all the collections we know about from the cache.

pollForChanges() public method

Poll the backend for changes.
public pollForChanges ( integer $heartbeat, integer $interval, array $options = [] ) : boolean | integer
$heartbeat integer The heartbeat lifetime to wait for changes.
$interval integer The wait interval between poll iterations.
$options array An options array containing any of: - pingable: (boolean) Only poll collections with the pingable flag set. DEFAULT: false
return boolean | integer True if changes were detected in any of the collections, false if no changes detected or a status code if failed.

resetPingCache() public method

Force reset all collection's PINGABLE flag. Used to force client to issue a non-empty PING request.
public resetPingCache ( )

save() public method

Save the syncCache to storage.
public save ( boolean $preserve_folders = false )
$preserve_folders boolean If true, ensure the folder cache is not overwritten. @since 2.18.0

setDefaultWindowSize() public method

Note that this is really a ceiling on the number of TOTAL responses that can be sent (including all collections). This method should be renamed for 3.0
public setDefaultWindowSize ( integer $window, boolean $override = false )
$window integer The windowsize
$override boolean If true, this value will override any client supplied value.

setGetChangesFlag() public method

Set the getchanges flag on the specified collection.
public setGetChangesFlag ( string $collection_id )
$collection_id string The collection id.

setHeartbeat() public method

Set the looping sync heartbeat values.
public setHeartbeat ( array $hb )
$hb array An array containing one or both of: hbinterval, wait.

updateCache() public method

Update the syncCache with current collection data.
public updateCache ( )

updateCollectionsFromCache() public method

Updates data from the cache for collectons that are already loaded. Used to ensure looping SYNC and PING requests are operating on the most recent syncKey.

updateFolderinHierarchy() public method

Update/Add a folder in the hierarchy cache.
public updateFolderinHierarchy ( Horde_ActiveSync_Message_Folder $folder, boolean $update = false )
$folder Horde_ActiveSync_Message_Folder The folder object.
$update boolean Update the state objects? @since 2.4.0

updateHierarchyKey() public method

Update the hierarchy synckey in the cache.
public updateHierarchyKey ( string $key )
$key string The new/existing synckey.

updatePingableFlag() public method

Marks all loaded collections with a synckey as pingable.
public updatePingableFlag ( )

validateFromCache() public method

Validates the collection data from the syncCache, filling in missing values from the folder cache.
public validateFromCache ( )

validateHierarchyChanges() public method

Validate and perform some sanity checks on the hierarchy changes before being sent to the client.
public validateHierarchyChanges ( Horde_ActiveSync_Connector_Exporter_FolderSync $exporter, array $seenFolders )
$exporter Horde_ActiveSync_Connector_Exporter_FolderSync The exporter.
$seenFolders array An array of folders.

Property Details

$_as protected_oe property

The ActiveSync server object.
protected Horde_ActiveSync $_as
return Horde_ActiveSync

$_cache protected_oe property

The syncCache
protected Horde_ActiveSync_SyncCache $_cache
return Horde_ActiveSync_SyncCache

$_changedCollections protected_oe property

Cache of collections that have had changes detected.
protected array $_changedCollections
return array

$_changes protected_oe property

Cache of changes.
protected array $_changes
return array

$_collections protected_oe property

The collection data
protected array $_collections
return array

$_globalWindowSize protected_oe property

Global WINDOWSIZE Defaults to 100 (MS-ASCMD 2.2.3.188)
protected int $_globalWindowSize
return integer

$_hangingSync protected_oe property

Flag to indicate the client is requesting a hanging SYNC.
protected bool $_hangingSync
return boolean

$_importedChanges protected_oe property

Imported changes flag.
protected bool $_importedChanges
return boolean

$_logger protected_oe property

The logger
protected Horde_Log_Logger $_logger
return Horde_Log_Logger

$_procid protected_oe property

Cache the process id for logging.
protected int $_procid
return integer

$_shortSyncRequest protected_oe property

Short sync request flag.
protected bool $_shortSyncRequest
return boolean

$_synckeyCount protected_oe property

Count of available synckeys
protected int $_synckeyCount
return integer

$_tempSyncCache protected_oe property

Cache a temporary syncCache.
protected Horde_ActiveSync_SyncCache $_tempSyncCache
return Horde_ActiveSync_SyncCache

$_unchangedCount protected_oe property

Count of unchanged collections calculated for PARTIAL sync.
protected int $_unchangedCount
return integer

$_windowsizeOverride protected_oe property

Flag to indicate we have overridden the globalWindowSize
protected bool $_windowsizeOverride
return boolean