Bug #55298
closedsys_history broken because of sys_log task
100%
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
Updated by Steffen Müller almost 11 years ago
sys_history and sys_log are tightly coupled. I would love to see this decoupled.
Nevertheless this story will not be solved with 6.2.
To solve this for 6.2, I would vote for
a) When deleting sys_log entries also delete related sys_history
and add a note to the task. Not sure how to handle this for 6.1.
What do others think?
Updated by Steffen Müller almost 11 years ago
I had a quick look at the backend. It looks like no history record is shown without a corresponding sys_log entry.
If that's true, I would suggest to leave things like they are for now. Once we have decoupled sys_history from sys_log, this can be be solved in a more clean way.
Would it work for you if you set up two tasks, one to clear sys_log, the other to clear sys_history?
Updated by Stefan Froemken almost 11 years ago
I think it would be better to add a col to sys_history called "be_user". So we can delete sys_log entries without losing the information WHO has changed what and when.
Updated by Georg Kühnberger over 10 years ago
I highly support Stefan Froemken's suggestion to decouple the two tables; as the current situation is a) Double-entry bookkeeping and b) sys_log is somehow illnamed asuming that all tables with _log in the name might be deleted without loosing the BE-functionality to see the changes & diffs & being able to restore a change.
Updated by Alexander Opitz about 9 years ago
- Target version changed from 6.2.0 to 8 LTS
Updated by Andreas Allacher almost 9 years ago
Sys Log also has an icon to sys history which I think should be kept.
That one, most likely still would to have use the sys_log_uid but as mentioned in #71950 that could actually be easily fixed by retrieving the latest entry for the sys_log_uid in HistoryEntryViewHelper
Updated by Benni Mack over 7 years ago
- Target version changed from 8 LTS to next-patchlevel
Updated by Gerrit Code Review about 7 years ago
- Status changed from New to Under Review
Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 19 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 20 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 21 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 22 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 23 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 24 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 25 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 26 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 27 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Gerrit Code Review about 7 years ago
Patch set 28 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53195
Updated by Benni Mack about 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset d047b314162ad1683f116df762384ada8b9dd5f3.