mirror of https://github.com/MISP/MISP
chg: [internal] Use SORT_REGULAR for array_unique
parent
715ca6d1e2
commit
2f644a2a33
|
@ -619,7 +619,7 @@ class EventsController extends AppController
|
|||
if (empty($usersToMatch)) {
|
||||
$nothing = true;
|
||||
} else {
|
||||
$this->paginate['conditions']['AND'][] = ['Event.user_id' => array_unique($usersToMatch)];
|
||||
$this->paginate['conditions']['AND'][] = ['Event.user_id' => array_unique($usersToMatch, SORT_REGULAR)];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -30,4 +30,34 @@ class BetterCakeEventManager extends CakeEventManager
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $eventKey
|
||||
* @return array
|
||||
*/
|
||||
public function listeners($eventKey)
|
||||
{
|
||||
if ($this->_isGlobal) {
|
||||
$localListeners = [];
|
||||
} else {
|
||||
$localListeners = $this->_listeners[$eventKey] ?? [];
|
||||
}
|
||||
|
||||
$globalListeners = static::instance()->prioritisedListeners($eventKey);
|
||||
|
||||
$priorities = array_merge(array_keys($globalListeners), array_keys($localListeners));
|
||||
$priorities = array_unique($priorities, SORT_REGULAR);
|
||||
asort($priorities);
|
||||
|
||||
$result = [];
|
||||
foreach ($priorities as $priority) {
|
||||
if (isset($globalListeners[$priority])) {
|
||||
$result = array_merge($result, $globalListeners[$priority]);
|
||||
}
|
||||
if (isset($localListeners[$priority])) {
|
||||
$result = array_merge($result, $localListeners[$priority]);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -769,7 +769,7 @@ class Event extends AppModel
|
|||
}
|
||||
|
||||
$correlations = array_column($correlations, $correlationModelName);
|
||||
$eventIds = array_unique(array_column($correlations, 'event_id'));
|
||||
$eventIds = array_unique(array_column($correlations, 'event_id'), SORT_REGULAR);
|
||||
|
||||
$conditions = $this->createEventConditions($user);
|
||||
$conditions['Event.id'] = $eventIds;
|
||||
|
|
|
@ -1124,7 +1124,7 @@ class GalaxyCluster extends AppModel
|
|||
|
||||
if (!empty($tagsToFetch)) {
|
||||
$tags = $this->GalaxyClusterRelation->GalaxyClusterRelationTag->Tag->find('all', [
|
||||
'conditions' => ['id' => array_unique($tagsToFetch)],
|
||||
'conditions' => ['id' => array_unique($tagsToFetch, SORT_REGULAR)],
|
||||
'recursive' => -1,
|
||||
]);
|
||||
$tags = array_column(array_column($tags, 'Tag'), null, 'id');
|
||||
|
|
Loading…
Reference in New Issue