Skip to content
Snippets Groups Projects
Commit 995519b8 authored by Rushikesh Raval's avatar Rushikesh Raval Committed by Rajab Natshah
Browse files

Issue #3175052 by rushiraval: Fix PostgreSQL error not null constraint violation gives me an wsod

parent 899cd96e
No related branches found
No related tags found
No related merge requests found
......@@ -92,20 +92,29 @@ function admin_audit_trail_insert(array &$log) {
// Allow the altering of the log array.
\Drupal::service('module_handler')->invokeAll('admin_audit_trail_log_alter', ['log' => &$log]);
\Drupal::database()->merge('admin_audit_trail')
->key('lid')
->fields([
'type' => $log['type'],
'operation' => $log['operation'],
'description' => $log['description'],
'created' => $log['created'],
'uid' => $log['uid'],
'ip' => $log['ip'] ?? '',
'path' => $log['path'],
'ref_char' => $log['ref_char'],
'ref_numeric' => $log['ref_numeric'],
])
->execute();
$fields = [
'type' => $log['type'],
'operation' => $log['operation'],
'description' => $log['description'],
'created' => $log['created'],
'uid' => $log['uid'],
'ip' => $log['ip'],
'path' => $log['path'],
'ref_char' => $log['ref_char'],
'ref_numeric' => $log['ref_numeric'],
];
if (isset($log['lid'])) {
\Drupal::database()->update('admin_audit_trail')
->fields($fields)
->condition('lid', $log['lid'])
->execute();
}
else {
\Drupal::database()->insert('admin_audit_trail')
->fields($fields)
->execute();
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment