Changeset View
Changeset View
Standalone View
Standalone View
lib/ext/Syncroton/Command/Sync.php
Show First 20 Lines • Show All 464 Lines • ▼ Show 20 Lines | public function getResponse() | ||||
$wakeupCallback(); | $wakeupCallback(); | ||||
$now = new DateTime(null, new DateTimeZone('utc')); | $now = new DateTime(null, new DateTimeZone('utc')); | ||||
foreach($this->_collections as $collectionData) { | foreach($this->_collections as $collectionData) { | ||||
// continue immediately if folder does not exist | // continue immediately if folder does not exist | ||||
if (! ($collectionData->folder instanceof Syncroton_Model_IFolder)) { | if (! ($collectionData->folder instanceof Syncroton_Model_IFolder)) { | ||||
break 2; | // Ignore the not found folder. | ||||
// Outlook refuses to remove some folders, and keeps requesting them. | |||||
// Without this we end up in an endless loop: https://bifrost.kolabsystems.com/T399575 | |||||
continue; | |||||
// countinue immediately if syncstate is invalid | // countinue immediately if syncstate is invalid | ||||
} elseif (! ($collectionData->syncState instanceof Syncroton_Model_ISyncState)) { | } elseif (! ($collectionData->syncState instanceof Syncroton_Model_ISyncState)) { | ||||
break 2; | break 2; | ||||
} else { | } else { | ||||
if ($collectionData->getChanges !== true) { | if ($collectionData->getChanges !== true) { | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | public function getResponse() | ||||
// See: http://www.tine20.org/forum/viewtopic.php?f=12&t=12146 | // See: http://www.tine20.org/forum/viewtopic.php?f=12&t=12146 | ||||
// | // | ||||
// break if there are less than PingTimeout + 10 seconds left for the next loop | // break if there are less than PingTimeout + 10 seconds left for the next loop | ||||
// otherwise the response will be returned after the client has finished his Ping | // otherwise the response will be returned after the client has finished his Ping | ||||
// request already maybe | // request already maybe | ||||
} while (Syncroton_Server::validateSession() && time() - $intervalStart < $this->_heartbeatInterval - (Syncroton_Registry::getPingTimeout() + 10)); | } while (Syncroton_Server::validateSession() && time() - $intervalStart < $this->_heartbeatInterval - (Syncroton_Registry::getPingTimeout() + 10)); | ||||
} | } | ||||
// First check for folders hierarchy changes | |||||
foreach ($this->_collections as $collectionData) { | |||||
if (! ($collectionData->folder instanceof Syncroton_Model_IFolder)) { | |||||
// Without this Outlook will next do a FolderSync with the same syncKey, | |||||
// and thus not detect any changes. | |||||
$this->_syncStateBackend->resetState($this->_device, 'FolderSync'); | |||||
foreach($this->_collections as $collectionData) { | |||||
if (! ($collectionData->folder instanceof Syncroton_Model_IFolder)) { | |||||
// Ignore the not found folder. | |||||
// Outlook refuses to remove some folders, and keeps requesting them. | |||||
// Without this we end up in an endless loop: https://bifrost.kolabsystems.com/T399575 | |||||
if ($this->_logger instanceof Zend_Log) | if ($this->_logger instanceof Zend_Log) | ||||
$this->_logger->warn(__METHOD__ . '::' . __LINE__ . " Detected a folder hierarchy change on {$collectionData->collectionId}."); | $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " Detected an unknown folder, skipping {$collectionData->collectionId}."); | ||||
$sync->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'Status', self::STATUS_FOLDER_HIERARCHY_HAS_CHANGED)); | continue; | ||||
return $this->_outputDom; | |||||
} | |||||
} | } | ||||
foreach($this->_collections as $collectionData) { | |||||
$collectionChanges = 0; | $collectionChanges = 0; | ||||
/** | /** | ||||
* keep track of entries added on server side | * keep track of entries added on server side | ||||
*/ | */ | ||||
$newContentStates = array(); | $newContentStates = array(); | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 606 Lines • Show Last 20 Lines |