#55298sys_history broken because of sys_log task
Description
Hello Coreteam,
we have activated scheduler task to clean up sys_log, so only last 90 days are in log.
Now we have found out that the history of some older records were deleted, but still available in sys_history.
I have searched the core and found method getHistoryData in RecordHistory.php. There you build following Query:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_history.*, sys_log.userid', 'sys_history, sys_log', 'sys_history.sys_log_uid = sys_log.uid
AND sys_history.tablename = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_history') . '
AND sys_history.recuid = ' . intval($uid), '', 'sys_log.uid DESC', $this->maxSteps);
As you can see, this query can only build entries from sys_history where a relation to a sys_log entry exists. The entry from sys_log was deleted, so output of module history is incomplete.
So what to do?
- When deleting sys_log entries also delete related sys_history
- Modify task to only delete non related entries.
Stefan