Commit 1d374d62 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-ZP-1247 Check for if a synckey was confirmed in the request.

If the synckey was confirmed the folderdata needs to be updated so the
data is consistent when an old state is deleted.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 90319667
......@@ -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,6 +1208,7 @@ 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
if (self::$backend->HasFolderStats()) {
$newFolderStatAfterExport = self::$backend->GetFolderStat(ZPush::GetAdditionalSyncFolderStore($spa->GetBackendFolderId()), $spa->GetBackendFolderId());
if ($newFolderStat === $newFolderStatAfterExport) {
$this->setFolderStat($spa, $newFolderStat);
......@@ -1216,6 +1217,7 @@ class Sync extends RequestProcessor {
ZLog::Write(LOGLEVEL_DEBUG, "Sync() Folderstat differs after export, force another exporter run.");
}
}
}
else
self::$deviceManager->SetFolderSyncStatus($spa->GetFolderId(), DeviceManager::FLD_SYNC_INPROGRESS);
}
......
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