mirror of https://github.com/MISP/MISP
chg: [sync] Examine less events for sightings pulling
parent
407008af16
commit
4973c7480d
|
@ -55,7 +55,7 @@ class EventBlocklist extends AppModel
|
|||
public function removeBlockedEvents(array &$eventArray)
|
||||
{
|
||||
// When event array contains a lot events, it is more efficient to fetch all blocked events
|
||||
$conditions = count($eventArray) > 10000 ? [] : ['EventBlocklist.event_uuid' => array_column($eventArray, 'uuid')];
|
||||
$conditions = (count($eventArray) > 10000) ? [] : ['EventBlocklist.event_uuid' => array_column($eventArray, 'uuid')];
|
||||
$blocklistHits = $this->find('column', [
|
||||
'conditions' => $conditions,
|
||||
'fields' => ['EventBlocklist.event_uuid'],
|
||||
|
|
|
@ -1127,10 +1127,17 @@ class Sighting extends AppModel
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Remove events from list that do not have published sightings.
|
||||
foreach ($remoteEvents as $k => $remoteEvent) {
|
||||
if ($remoteEvent['sighting_timestamp'] == 0) {
|
||||
unset($remoteEvents[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
// Downloads sightings just from events that exists locally and remote sighting_timestamp is newer than local.
|
||||
$localEvents = $this->Event->find('list', [
|
||||
'fields' => ['Event.uuid', 'Event.sighting_timestamp'],
|
||||
'conditions' => count($remoteEvents) > 10000 ? ['Event.uuid' => array_column($remoteEvents, 'uuid')] : [],
|
||||
'conditions' => (count($remoteEvents) > 10000) ? [] : ['Event.uuid' => array_column($remoteEvents, 'uuid')],
|
||||
]);
|
||||
|
||||
$eventUuids = [];
|
||||
|
|
Loading…
Reference in New Issue