Commit a9aa9acc authored by skummer's avatar skummer

ZP-362 #comment expose GetFolderType() through DeviceManager, when loading...

ZP-362 #comment expose GetFolderType() through DeviceManager, when loading states in heartbeat, ignore OUTBOX folders #time 1h

git-svn-id: https://z-push.org/svn/z-push/trunk@1727 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 2e35d07c
...@@ -333,6 +333,18 @@ class DeviceManager { ...@@ -333,6 +333,18 @@ class DeviceManager {
return $this->stateManager->InitializeFolderCache($folders); return $this->stateManager->InitializeFolderCache($folders);
} }
/**
* Returns the ActiveSync folder type for a FolderID
*
* @param string $folderid
*
* @access public
* @return int/boolean boolean if no type is found
*/
public function GetFolderTypeFromCacheById($folderid) {
return $this->device->GetFolderType($folderid);
}
/** /**
* Returns a FolderID of default classes * Returns a FolderID of default classes
* this is for AS 1.0 compatibility: * this is for AS 1.0 compatibility:
......
...@@ -530,7 +530,7 @@ class Sync extends RequestProcessor { ...@@ -530,7 +530,7 @@ class Sync extends RequestProcessor {
if ($status == SYNC_STATUS_SUCCESS && ($emptysync === true || $partial === true) ) { if ($status == SYNC_STATUS_SUCCESS && ($emptysync === true || $partial === true) ) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Partial or Empty sync requested. Retrieving data of synchronized folders.")); ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Partial or Empty sync requested. Retrieving data of synchronized folders."));
// Load all collections - do not overwrite existing (received!), laod states and check permissions // Load all collections - do not overwrite existing (received!), load states and check permissions
try { try {
$sc->LoadAllCollections(false, true, true); $sc->LoadAllCollections(false, true, true);
} }
...@@ -569,6 +569,13 @@ class Sync extends RequestProcessor { ...@@ -569,6 +569,13 @@ class Sync extends RequestProcessor {
// states are lazy loaded - we have to make sure that they are there! // states are lazy loaded - we have to make sure that they are there!
$loadstatus = SYNC_STATUS_SUCCESS; $loadstatus = SYNC_STATUS_SUCCESS;
foreach($sc as $folderid => $spa) { foreach($sc as $folderid => $spa) {
// some androids do heartbeat on the OUTBOX folder, with weird results - ZP-362
// we do not load the state so we will never get relevant changes on the OUTBOX folder
if (self::$deviceManager->GetFolderTypeFromCacheById($folderid) == SYNC_FOLDER_TYPE_OUTBOX) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync(): Heartbeat on Outbox folder not allowed"));
continue;
}
$fad = array(); $fad = array();
// if loading the states fails, we do not enter heartbeat, but we keep $status on SYNC_STATUS_SUCCESS // if loading the states fails, we do not enter heartbeat, but we keep $status on SYNC_STATUS_SUCCESS
// so when the changes are exported the correct folder gets an SYNC_STATUS_INVALIDSYNCKEY // so when the changes are exported the correct folder gets an SYNC_STATUS_INVALIDSYNCKEY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment