- Affected version
- 2.2.10
I'd like to log more request data in spam trigger log, however this does seem somewhat difficult:
The array containing data about the request is hardcoded somewhere in the middle of
So there doesn't seem to be a direct way to add data here:
Could this be changed so
This would allow to add custom more data in a clean way.
The array containing data about the request is hardcoded somewhere in the middle of
AbstractTrigger::logSpamTrigger
PHP:
$request = [
'url' => $request->getRequestUri(),
'referrer' => $request->getReferrer() ?: '',
'_GET' => $_GET,
'_POST' => $request->filterForLog($_POST),
];
$values = [
'content_type' => $contentType,
'content_id' => $contentId,
'log_date' => time(),
'user_id' => $userId,
'ip_address' => $ipAddress,
'result' => $result,
'details' => json_encode($this->details),
'request_state' => json_encode($request)
];
So there doesn't seem to be a direct way to add data here:
- I could duplicate the whole method in my class
- I could read the record after calling the parent, modify it and save it again
Doable and probably the best approach for now, but doesn't feel nice as it causes unnecessary DB writes - I could override method
json_encode
in namespaceXF\Spam
That would be really hacky
logDetail
(ant not use it in the phrase), but then this would not get displayed when vieing spam trigger logCould this be changed so
$request
does get set by a method like getRequestDataForLog
?This would allow to add custom more data in a clean way.
Last edited: