PHP Class Horde_ActiveSync_Collections, horde

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

Protected Properties

Свойство 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

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

..
public __call ( $method, $parameters )

__construct() public méthode

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 méthode

Property getter
public __get ( $property )

__set() public méthode

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

_checkConfirmedKeys() protected méthode

protected _checkConfirmedKeys ( )

_getMissingCollectionsFromCache() protected méthode

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

_haveNoChangesInPartialSync() protected méthode

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.
protected _haveNoChangesInPartialSync ( ) : boolean
Résultat boolean

_sleep() protected méthode

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 méthode

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 méthode

Return the count of collections in the cache only.
public cachedCollectionCount ( ) : integer
Résultat integer

canDoLoopingSync() public méthode

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
Résultat boolean True if we want a looping sync, false otherwise.

canSendEmptyResponse() public méthode

Return if we can do an empty response
public canSendEmptyResponse ( ) : boolean
Résultat boolean

checkFilterType() public méthode

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.
Résultat boolean True if filtertype passed, false if it has changed.

checkStaleRequest() public méthode

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
Résultat boolean True if the current looping sync is stale. False otherwise.

collectionCount() public méthode

Return the count of available collections.
public collectionCount ( ) : integer
Résultat integer

deleteFolderFromHierarchy() public méthode

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

ensureOptions() public méthode

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

getBackendIdForFolderUid() public méthode

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

getChangesFlag() public méthode

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

getCollectionChangeCount() public méthode

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

getCollectionChanges() public méthode

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.
Résultat array The changes array.

getCollectionClass() public méthode

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

getCollectionType() public méthode

public getCollectionType ( $id )

getDefaultWindowSize() public méthode

getFolderUidForBackendId() public méthode

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

getHeartbeat() public méthode

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

getHierarchyChanges() public méthode

Return all know hierarchy changes.
public getHierarchyChanges ( ) : array
Résultat array An array of changes.

getIterator() public méthode

Iterator
public getIterator ( )

getNewCollection() public méthode

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

haveHierarchy() public méthode

Return if we have a current folder hierarchy.
public haveHierarchy ( ) : boolean
Résultat boolean

havePingableCollections() public méthode

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

haveSyncableCollections() public méthode

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

initCollectionState() public méthode

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 méthode

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

initFullSync() public méthode

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

initHierarchySync() public méthode

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

initPartialSync() public méthode

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

loadCollectionsFromCache() public méthode

Load all the collections we know about from the cache.

pollForChanges() public méthode

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
Résultat 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 méthode

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

save() public méthode

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 méthode

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 méthode

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

setHeartbeat() public méthode

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

updateCache() public méthode

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

updateCollectionsFromCache() public méthode

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 méthode

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 méthode

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

updatePingableFlag() public méthode

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

validateFromCache() public méthode

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

validateHierarchyChanges() public méthode

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
Résultat Horde_ActiveSync

$_cache protected_oe property

The syncCache
protected Horde_ActiveSync_SyncCache $_cache
Résultat Horde_ActiveSync_SyncCache

$_changedCollections protected_oe property

Cache of collections that have had changes detected.
protected array $_changedCollections
Résultat array

$_changes protected_oe property

Cache of changes.
protected array $_changes
Résultat array

$_collections protected_oe property

The collection data
protected array $_collections
Résultat array

$_globalWindowSize protected_oe property

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

$_hangingSync protected_oe property

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

$_importedChanges protected_oe property

Imported changes flag.
protected bool $_importedChanges
Résultat boolean

$_logger protected_oe property

The logger
protected Horde_Log_Logger $_logger
Résultat Horde_Log_Logger

$_procid protected_oe property

Cache the process id for logging.
protected int $_procid
Résultat integer

$_shortSyncRequest protected_oe property

Short sync request flag.
protected bool $_shortSyncRequest
Résultat boolean

$_synckeyCount protected_oe property

Count of available synckeys
protected int $_synckeyCount
Résultat integer

$_tempSyncCache protected_oe property

Cache a temporary syncCache.
protected Horde_ActiveSync_SyncCache $_tempSyncCache
Résultat Horde_ActiveSync_SyncCache

$_unchangedCount protected_oe property

Count of unchanged collections calculated for PARTIAL sync.
protected int $_unchangedCount
Résultat integer

$_windowsizeOverride protected_oe property

Flag to indicate we have overridden the globalWindowSize
protected bool $_windowsizeOverride
Résultat boolean