fix: [internal] potential fix to the sighting_timestamp missing issue when syncing with older instances

pull/5435/head
iglocska 2019-11-26 17:12:55 +01:00
parent bd17bdfb6b
commit f1c6465050
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 9 additions and 4 deletions

View File

@ -4558,11 +4558,16 @@ class Event extends AppModel
$localEvents[$e['Event']['uuid']] = array($field => $e['Event'][$field], 'locked' => $e['Event']['locked']);
}
foreach ($uuidsToCheck as $uuid => $eventArrayId) {
if (isset($localEvents[$uuid])
&& ($localEvents[$uuid][$field] >= $eventArray[$eventArrayId][$field]
|| ($scope === 'events' && !$localEvents[$uuid]['locked'])))
{
// remove all events for the sighting sync if the remote is not aware of the new field yet
if (!isset($eventArray[$eventArrayId][$field])) {
unset($eventArray[$eventArrayId]);
} else {
if (isset($localEvents[$uuid])
&& ($localEvents[$uuid][$field] >= $eventArray[$eventArrayId][$field]
|| ($scope === 'events' && !$localEvents[$uuid]['locked'])))
{
unset($eventArray[$eventArrayId]);
}
}
}
}