Commit 774744c6 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #554 in ZP/z-push from...

Merge pull request #554 in ZP/z-push from bugfix/ZP-1247-unexpected-synckey-stateinvalidexception to develop

* commit '1d374d62':
  ZP-ZP-1247 Check for if a synckey was confirmed in the request.
parents fe122669 1d374d62
......@@ -286,6 +286,17 @@ class SyncParameters extends StateObject {
$this->checkCPO($this->currentCPO);
}
/**
* Indicates if the confirmation status changed for the SyncKey.
*
* @access public
* @return boolean
*/
public function HasConfirmationChanged() {
return $this->confirmationChanged;
}
/**
* Indicates if a exporter run is required. This is the case if the given folderstat is different from the saved one
* or when the expiration time expired.
......
......@@ -887,7 +887,7 @@ class Sync extends RequestProcessor {
// Fir AS 14.0+ omit output for folder, if there were no incoming or outgoing changes and no Fetch
if (Request::GetProtocolVersion() >= 14.0 && ! $spa->HasNewSyncKey() && $changecount == 0 && empty($actiondata["fetchids"]) && $status == SYNC_STATUS_SUCCESS &&
($newFolderStat === false || ! $spa->IsExporterRunRequired($newFolderStat))) {
! $spa->HasConfirmationChanged() && ($newFolderStat === false || ! $spa->IsExporterRunRequired($newFolderStat))) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandleSync: No changes found for %s folder id '%s'. Omitting output.", $spa->GetContentClass(), $spa->GetFolderId()));
continue;
}
......@@ -1208,12 +1208,14 @@ class Sync extends RequestProcessor {
self::$deviceManager->SetFolderSyncStatus($spa->GetFolderId(), DeviceManager::FLD_SYNC_COMPLETED);
// we should update the folderstat, but we recheck to see if it changed. If so, it's not updated to force another sync
$newFolderStatAfterExport = self::$backend->GetFolderStat(ZPush::GetAdditionalSyncFolderStore($spa->GetBackendFolderId()), $spa->GetBackendFolderId());
if ($newFolderStat === $newFolderStatAfterExport) {
$this->setFolderStat($spa, $newFolderStat);
}
else {
ZLog::Write(LOGLEVEL_DEBUG, "Sync() Folderstat differs after export, force another exporter run.");
if (self::$backend->HasFolderStats()) {
$newFolderStatAfterExport = self::$backend->GetFolderStat(ZPush::GetAdditionalSyncFolderStore($spa->GetBackendFolderId()), $spa->GetBackendFolderId());
if ($newFolderStat === $newFolderStatAfterExport) {
$this->setFolderStat($spa, $newFolderStat);
}
else {
ZLog::Write(LOGLEVEL_DEBUG, "Sync() Folderstat differs after export, force another exporter run.");
}
}
}
else
......
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