Commit aeab7567 authored by Sebastian Kummer's avatar Sebastian Kummer

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

Merge pull request #72 in ZP/z-push from bugfix/ZP-730-check-internal-notifications-if-states to develop

* commit '0d4b2873':
  ZP-730 Undo change of ZP-631 (enabling notification check again). Check the states integrity before validating the notification. If state has been use, force a sync of the folder.
parents f262bf07 0d4b2873
...@@ -517,19 +517,15 @@ class SyncCollections implements Iterator { ...@@ -517,19 +517,15 @@ class SyncCollections implements Iterator {
$validNotifications = false; $validNotifications = false;
foreach ($notifications as $folderid) { foreach ($notifications as $folderid) {
// ZP-631 - temporary disable checking validity of notifications // check if the notification on the folder is within our filter
// notify mobile for all received notifications if ($this->CountChange($folderid)) {
$this->changes[$folderid] = 1; ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s'", $folderid));
$validNotifications = true; $validNotifications = true;
// // check if the notification on the folder is within our filter $this->waitingTime = time()-$started;
// if ($this->CountChange($folderid)) { }
// ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s'", $folderid)); else {
// $validNotifications = true; ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s', but it is not relevant", $folderid));
// $this->waitingTime = time()-$started; }
// }
// else {
// ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s', but it is not relevant", $folderid));
// }
} }
if ($validNotifications) if ($validNotifications)
return true; return true;
...@@ -587,6 +583,13 @@ class SyncCollections implements Iterator { ...@@ -587,6 +583,13 @@ class SyncCollections implements Iterator {
private function CountChange($folderid) { private function CountChange($folderid) {
$spa = $this->GetCollection($folderid); $spa = $this->GetCollection($folderid);
// prevent ZP-623 by checking if the states have been used before, if so force a sync on this folder
if (ZPush::GetDeviceManager()->CheckHearbeatStateIntegrity($spa->GetFolderId(), $spa->GetUuid(), $spa->GetUuidCounter())) {
ZLog::Write(LOGLEVEL_DEBUG, "SyncCollections->CountChange(): Cannot verify changes for state as it was already used. Forcing sync of folder.");
$this->changes[$folderid] = 1;
return true;
}
// switch user store if this is a additional folder (additional true -> do not debug) // switch user store if this is a additional folder (additional true -> do not debug)
ZPush::GetBackend()->Setup(ZPush::GetAdditionalSyncFolderStore($folderid, true)); ZPush::GetBackend()->Setup(ZPush::GetAdditionalSyncFolderStore($folderid, true));
$changecount = false; $changecount = false;
......
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