diff options
author | Kate Butler <kate@innocraft.com> | 2019-09-04 00:09:48 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-09-04 00:09:48 +0300 |
commit | e84f89fd7207fbb5eac7782e0e1affa0a48b3462 (patch) | |
tree | 7c2685c2ba65444b61c62e365e126b8483706b95 | |
parent | 17cc46f0a26e85ce6d3645aa60e0c1ee1611d683 (diff) |
Don't process tracking requests that are older than data purge cutoff (#14831)
* Exclude visits whose time is prior to the log purge cutoff time from being logged
* Cache data purge settings
* Move logic for checking whether request is older than purge cutoff into getCustomTimestamp() method
* Change error message
-rw-r--r-- | core/Tracker/Request.php | 12 | ||||
-rw-r--r-- | plugins/PrivacyManager/PrivacyManager.php | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php index e1c59f5e05..fce9b8f0c7 100644 --- a/core/Tracker/Request.php +++ b/core/Tracker/Request.php @@ -502,6 +502,18 @@ class Request } } + $cache = Tracker\Cache::getCacheGeneral(); + if (!empty($cache['delete_logs_enable']) && !empty($cache['delete_logs_older_than'])) { + $scheduleInterval = $cache['delete_logs_schedule_lowest_interval']; + $maxLogAge = $cache['delete_logs_older_than']; + $logEntryCutoff = time() - (($maxLogAge + $scheduleInterval) * 60*60*24); + if ($cdt < $logEntryCutoff) { + $message = "Custom timestamp is older than the configured 'deleted old raw data' value of $maxLogAge days"; + Common::printDebug($message); + throw new InvalidRequestParameterException($message); + } + } + return $cdt; } diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index d073dd0cd7..99deb31fce 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -203,6 +203,11 @@ class PrivacyManager extends Plugin $config = new Config(); $cacheContent = $config->setTrackerCacheGeneral($cacheContent); $cacheContent[self::OPTION_USERID_SALT] = self::getUserIdSalt(); + + $purgeSettings = PrivacyManager::getPurgeDataSettings(); + $cacheContent['delete_logs_enable'] = $purgeSettings['delete_logs_enable']; + $cacheContent['delete_logs_schedule_lowest_interval'] = $purgeSettings['delete_logs_schedule_lowest_interval']; + $cacheContent['delete_logs_older_than'] = $purgeSettings['delete_logs_older_than']; } public function getJsFiles(&$jsFiles) |