From 2b50dc3f1d66b7c0f76547222bde032da682a3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Wed, 5 Jun 2019 11:34:46 +0200 Subject: [PATCH] :ambulance: fix(logging) Store microseconds in audit datetime This avoids having too many audit events on the same timestamp. issue #5995 --- include/class_logging.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/class_logging.inc b/include/class_logging.inc index 5cb276a58..441d2c444 100644 --- a/include/class_logging.inc +++ b/include/class_logging.inc @@ -61,7 +61,7 @@ class logging /* Create data object */ $entry = [ - 'timestamp' => time(), + 'timestamp' => microtime(TRUE), 'action' => $action, 'objecttype' => $objecttype, 'object' => $object, @@ -144,7 +144,7 @@ class logging } $tabObject = objects::create('auditEvent'); $baseObject = $tabObject->getBaseObject(); - $baseObject->fdAuditDateTime = new DateTime('@'.$entry['timestamp']); + $baseObject->fdAuditDateTime = DateTime::createFromFormat('U.u', number_format($entry['timestamp'], 6, '.', '')); $baseObject->fdAuditAction = $entry['action']; $baseObject->fdAuditAuthorDN = $entry['user']; $baseObject->fdAuditObjectType = $entry['objecttype']; -- GitLab