mirror of https://github.com/MISP/MISP
chg: [log] Log when saving tags fails for attribute or event
parent
60ac21e252
commit
b5856d6f73
|
@ -3616,7 +3616,11 @@ class Attribute extends AppModel
|
|||
$at['event_id'] = $eventId;
|
||||
$toSave[] = $at;
|
||||
}
|
||||
$this->AttributeTag->saveMany($toSave, ['validate' => true]);
|
||||
if (!$this->AttributeTag->saveMany($toSave, ['validate' => true])) {
|
||||
$this->log("Could not save tags when capturing attribute with ID {$this->id}.", LOG_WARNING);
|
||||
} else if (!empty($this->AttributeTag->validationErrors)) {
|
||||
$this->log("Could not save some tags when capturing attribute with ID {$this->id}: " . json_encode($this->AttributeTag->validationErrors), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
if (isset($attribute['Tag'])) {
|
||||
if (!empty($attribute['Tag']['name'])) {
|
||||
|
|
|
@ -3823,7 +3823,11 @@ class Event extends AppModel
|
|||
$et['event_id'] = $this->id;
|
||||
$toSave[] = $et;
|
||||
}
|
||||
$this->EventTag->saveMany($toSave, ['validate' => true]);
|
||||
if (!$this->EventTag->saveMany($toSave, ['validate' => true])) {
|
||||
$this->log("Could not save tags when capturing event with ID {$this->id}.", LOG_WARNING);
|
||||
} else if (!empty($this->EventTag->validationErrors)) {
|
||||
$this->log("Could not save some tags when capturing event with ID {$this->id}: " . json_encode($this->EventTag->validationErrors), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
$parentEvent = $this->find('first', array(
|
||||
'conditions' => array('Event.id' => $this->id),
|
||||
|
|
Loading…
Reference in New Issue