Commit cf9d9a20 authored by Sebastian Kummer's avatar Sebastian Kummer

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

Merge pull request #267 in ZP/z-push from bugfix/ZP-951-error-messages-when-synchronizing to develop

* commit '74f04e4c':
  ZP-952 Don't try to convert folderid if this is a hierarchy notification.
  ZP-951 Do not compare for type, as key(false) returns 0 (integer).
parents 0f1c5977 74f04e4c
...@@ -594,25 +594,28 @@ class SyncCollections implements Iterator { ...@@ -594,25 +594,28 @@ class SyncCollections implements Iterator {
$validNotifications = false; $validNotifications = false;
foreach ($notifications as $backendFolderId) { foreach ($notifications as $backendFolderId) {
// the backend will notify on the backend folderid
$folderid = ZPush::GetDeviceManager()->GetFolderIdForBackendId($backendFolderId);
// Check hierarchy notifications // Check hierarchy notifications
if ($folderid === IBackend::HIERARCHYNOTIFICATION) { if ($folderid === IBackend::HIERARCHYNOTIFICATION) {
// wait two seconds before validating this notification, because it could potentially be made by the mobile and we need some time to update the states. // wait two seconds before validating this notification, because it could potentially be made by the mobile and we need some time to update the states.
sleep(2); sleep(2);
// check received hierarchy notifications by exporting // check received hierarchy notifications by exporting
if ($this->countHierarchyChange(true)) if ($this->countHierarchyChange(true)) {
throw new StatusException("SyncCollections->CheckForChanges(): HierarchySync required.", self::HIERARCHY_CHANGED); throw new StatusException("SyncCollections->CheckForChanges(): HierarchySync required.", self::HIERARCHY_CHANGED);
} }
// check if the notification on the folder is within our filter
else if ($this->CountChange($folderid)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s'", $folderid));
$validNotifications = true;
$this->waitingTime = time()-$started;
} }
else { else {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s', but it is not relevant", $folderid)); // the backend will notify on the backend folderid
$folderid = ZPush::GetDeviceManager()->GetFolderIdForBackendId($backendFolderId);
// check if the notification on the folder is within our filter
if ($this->CountChange($folderid)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s'", $folderid));
$validNotifications = true;
$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)
...@@ -884,7 +887,7 @@ class SyncCollections implements Iterator { ...@@ -884,7 +887,7 @@ class SyncCollections implements Iterator {
* @return boolean * @return boolean
*/ */
public function valid() { public function valid() {
return (key($this->collections) !== null && key($this->collections) !== false); return (key($this->collections) != null && key($this->collections) != 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