New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't process tracking requests that are older than data purge cutoff #14831
Conversation
core/Tracker/Visit.php
Outdated
@@ -130,6 +130,17 @@ public function handle() | |||
|
|||
$this->visitProperties = new VisitProperties(); | |||
|
|||
// Break early if request timestamp is older than the cutoff for deleting older log entries | |||
$cache = Tracker\Cache::getCacheGeneral(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 works nicely @katebutler
One thought: let's maybe move the logic to here: https://github.com/matomo-org/matomo/blob/3.x-dev/core/Tracker/Request.php#L503-L505
Could we also throw an InvalidRequestParameterException
and a message that explains that timestamp is too old and data would be deleted again because of log retention ? A Common::printDebug
be good as well.
At first was thinking we should fail silently as otherwise anyone could find out whether a user as raw data retention configured and to how many days the raw data retention is set). However, this is not possible because you need to authenticate the request anyway when tracking a request with a timestamp of older than one day. So only users with at least write access would be possible to find out about this and there it is fine.
Be good to throw an exception 👍
…to getCustomTimestamp() method
core/Tracker/Request.php
Outdated
$maxLogAge = $cache['delete_logs_older_than']; | ||
$logEntryCutoff = time() - (($maxLogAge + $scheduleInterval) * 60*60*24); | ||
if ($cdt < $logEntryCutoff) { | ||
$message = "Request skipped as custom timestamp is older than $maxLogAge days"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@katebutler could we mention log deletion in the exception message somehow? Otherwise people might be contacting us asking why the don't accept custom timestamps older than X days.
Something like Custom timestamp is older than the configured "delete old raw data" value of X days
Fixes #14802