History and log

Every change the DataHandler makes leaves traces besides the record itself: an entry in sys_history with the old and new values, an entry in sys_log, an up-to-date reference index in sys_refindex and the timestamps crdate and tstamp. Each scenario below makes the same change once through the DataHandler and once through Extbase, as the same administrator at the same fixed time, and compares these traces.

Provenance

Tests ran on main (15.0-dev), which is assumed to behave as TYPO3 14.3.

Summary

12 scenarios, by Extbase status:

Comparison

ScenarioCoreExtbase
History of a created record A new item is created in the default language through DataHandler. DataHandler writes one history entry of the type "add" for the new uid 5, with the whole new record as history data. DeviatesExtbase writes two history entries for the new uid 5: an add entry and a modify entry with an empty old record. Their history data lists the properties of the object (uid, pid, title, the class of the tags) and the Extbase class name, not the database fields.
History of a changed record The title of the English item is changed through DataHandler. DataHandler writes one history entry of the type "modify" for the item, with the old and the new value of the changed field. DeviatesExtbase writes one modify entry for item 1. Its history data holds the complete old and new property set of the object (uid, pid, title, the class of the tags) plus the Extbase class name, not only the changed field.
History of a changed translation The title of the German translation is changed through DataHandler. DataHandler writes one history entry of the type "modify" for the uid of the translation, not for the English item. DeviatesExtbase writes one modify entry for the uid of the English item 1, not for the translation 2. The history data names the old and new title of the translation, under the uid of the English item.
History of a deleted record An English item without translation is deleted through DataHandler. DataHandler writes one history entry of the type "delete" without history data. Same as coreExtbase writes one delete entry for item 3 without history data, like DataHandler.
History with the default configuration The title of the English item is changed through DataHandler while Extbase history tracking keeps its default configuration. DataHandler writes the history entry regardless of that setting. DeviatesExtbase writes no history entry for the changed title, sys_history stays empty.
Log of a created record A new item is created in the default language through DataHandler. DataHandler writes one sys_log entry for the new uid 5, with the action "insert" (1), the message "Record {table}:{uid} was inserted on page {pid}" and the page of the item in the log data. DeviatesExtbase creates the item but writes no sys_log entry.
Log of a changed record The title of the English item is changed through DataHandler. DataHandler writes one sys_log entry with the action "update" (2) and the message "Record {table}:{uid} was updated". DeviatesExtbase changes the item but writes no sys_log entry.
Log of a deleted record An English item without translation is deleted through DataHandler. DataHandler writes one sys_log entry with the action "delete" (3) and the message "Record {table}:{uid} was deleted from pages:{pid}". DeviatesExtbase removes the item but writes no sys_log entry.
Reference index after adding tags The tags 1 and 2 are attached to item 1 through DataHandler. The reference index holds one row per tag for the field "tags" of item 1, with the position of the tag in the sorting. Same as coreExtbase updates the reference index to the same two rows for item 1 as DataHandler.
Reference index after removing the last tag The only tag of item 4 is detached through DataHandler. The reference index of item 4 was built beforehand and holds no row for item 4 afterwards. Same as coreExtbase removes the reference index row of item 4, the index is empty afterwards as with DataHandler.
Timestamps of a created record A new item is created through DataHandler. DataHandler sets crdate and tstamp of the new item to the current time and leaves the other items alone. Same as coreExtbase sets crdate and tstamp of the new item to the current time, as DataHandler does.
Timestamp of a changed record The title of the English item is changed through DataHandler. DataHandler sets tstamp of the item to the current time and keeps its crdate; the other items keep both columns. Same as coreExtbase sets tstamp of the changed item to the current time and keeps its crdate, as DataHandler does.

Scenarios

History of a created record

Deviates

In 14.3

Core: A new item is created in the default language through DataHandler. DataHandler writes one history entry of the type "add" for the new uid 5, with the whole new record as history data.

Extbase: Extbase writes two history entries for the new uid 5: an add entry and a modify entry with an empty old record. Their history data lists the properties of the object (uid, pid, title, the class of the tags) and the Extbase class name, not the database fields.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:86 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:107 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/History/CreatedRecord.csv (local)
SkipExtbase differs from core: it writes an add and a modify entry whose history data lists the properties of the object instead of the database fields.
TestHistoryTest::historyOfACreatedRecordByExtbase (Failure without skip)
Assertion in data-set failed for "sys_history":
array(
   'actiontype' => '1',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'recuid' => '5',
   'usertype' => 'BE',
   'userid' => '1',
   'tstamp' => '1700000000',
   'history_data' => '{"l10n_parent":0,"l10n_diffsource":"","pid":2,"title":"New item","crdate":1700000000,"tstamp":1700000000,"uid":5}',
   'correlation_id' => '\*'
)

Not asserted record found for "sys_history":
array(
   'tstamp' => '1700000000',
   'actiontype' => '1',
   'usertype' => 'BE',
   'userid' => '1',
   'recuid' => '5',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'history_data' => '{"uid":5,"pid":2,"title":"New item","tags":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","cascaded_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","ordered_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","images":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","_extbase_class":"TYPO3Tests\\ExtbaseFacts\\Domain\\Model\\Item","_pid":2}',
   'correlation_id' => '0400$TGCynLYJVhBbMDxS2w0fsmPhl47GlKK7:b0be276c550b60e45d6f6316f70c784b'
)

Not asserted record found for "sys_history":
array(
   'tstamp' => '1700000000',
   'actiontype' => '2',
   'usertype' => 'BE',
   'userid' => '1',
   'recuid' => '5',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'history_data' => '{"oldRecord":[],"newRecord":{"uid":5,"pid":2,"title":"New item","tags":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","cascaded_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","ordered_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","images":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage"},"_pid":2,"_extbase_class":"TYPO3Tests\\ExtbaseFacts\\Domain\\Model\\Item"}',
   'correlation_id' => '0400$TGCynLYJVhBbMDxS2w0fsmPhl47GlKK7:b0be276c550b60e45d6f6316f70c784b'
)

History of a changed record

Deviates

In 14.3

Core: The title of the English item is changed through DataHandler. DataHandler writes one history entry of the type "modify" for the item, with the old and the new value of the changed field.

Extbase: Extbase writes one modify entry for item 1. Its history data holds the complete old and new property set of the object (uid, pid, title, the class of the tags) plus the Extbase class name, not only the changed field.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:132 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:153 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/History/ChangedRecord.csv (local)
SkipExtbase differs from core: its history data lists all properties of the object instead of the changed database fields.
TestHistoryTest::historyOfAChangedRecordByExtbase (Failure without skip)
Assertion in data-set failed for "sys_history":
array(
   'actiontype' => '2',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'recuid' => '1',
   'usertype' => 'BE',
   'userid' => '1',
   'tstamp' => '1700000000',
   'history_data' => '{"oldRecord":{"title":"First item","l10n_diffsource":""},"newRecord":{"title":"Changed item","l10n_diffsource":"{\"title\":\"\"}"}}',
   'correlation_id' => '\*'
)

Not asserted record found for "sys_history":
array(
   'tstamp' => '1700000000',
   'actiontype' => '2',
   'usertype' => 'BE',
   'userid' => '1',
   'recuid' => '1',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'history_data' => '{"oldRecord":{"uid":1,"pid":2,"title":"First item","tags":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","cascaded_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","ordered_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","images":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage"},"newRecord":{"uid":1,"pid":2,"title":"Changed item","tags":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","cascaded_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","ordered_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","images":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage"},"_pid":2,"_extbase_class":"TYPO3Tests\\ExtbaseFacts\\Domain\\Model\\Item"}',
   'correlation_id' => '0400$v-2hftdIOUzwTwiz6V-GqduF5I6I3YcJ:e638ead942fd7711aba84f8bc24e597d'
)

History of a changed translation

Deviates

In 14.3

Core: The title of the German translation is changed through DataHandler. DataHandler writes one history entry of the type "modify" for the uid of the translation, not for the English item.

Extbase: Extbase writes one modify entry for the uid of the English item 1, not for the translation 2. The history data names the old and new title of the translation, under the uid of the English item.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:178 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:198 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/History/ChangedTranslation.csv (local)
SkipExtbase differs from core: it records the change on the uid of the default record instead of the uid of the translation.
TestHistoryTest::historyOfAChangedTranslationByExtbase (Failure without skip)
Assertion in data-set failed for "sys_history":
array(
   'actiontype' => '2',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'recuid' => '2',
   'usertype' => 'BE',
   'userid' => '1',
   'tstamp' => '1700000000',
   'history_data' => '{"oldRecord":{"title":"Erster Eintrag","l10n_diffsource":""},"newRecord":{"title":"Neuer Eintrag","l10n_diffsource":"{\"title\":\"First item\"}"}}',
   'correlation_id' => '\*'
)

Not asserted record found for "sys_history":
array(
   'tstamp' => '1700000000',
   'actiontype' => '2',
   'usertype' => 'BE',
   'userid' => '1',
   'recuid' => '1',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'history_data' => '{"oldRecord":{"uid":1,"pid":2,"title":"Erster Eintrag","tags":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","cascaded_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","ordered_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","images":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage"},"newRecord":{"uid":1,"pid":2,"title":"Neuer Eintrag","tags":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","cascaded_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","ordered_notes":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage","images":"TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage"},"_pid":2,"_extbase_class":"TYPO3Tests\\ExtbaseFacts\\Domain\\Model\\Item"}',
   'correlation_id' => '0400$45m3KVSjmxhCjIkLZNKM14XdsJL__scV:e638ead942fd7711aba84f8bc24e597d'
)

History of a deleted record

Same as core

In 14.3

Core: An English item without translation is deleted through DataHandler. DataHandler writes one history entry of the type "delete" without history data.

Extbase: Extbase writes one delete entry for item 3 without history data, like DataHandler.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:224 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:243 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/History/DeletedRecord.csv (local)

History with the default configuration

Deviates

In 14.3

Core: The title of the English item is changed through DataHandler while Extbase history tracking keeps its default configuration. DataHandler writes the history entry regardless of that setting.

Extbase: Extbase writes no history entry for the changed title, sys_history stays empty.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:265 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/HistoryTest.php:284 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/History/ChangedRecord.csv (local)
SkipExtbase differs from core: it writes no history entry as long as the feature toggle extbase.enableHistoryTracking is off.
TestHistoryTest::historyWithTheDefaultConfigurationByExtbase (Failure without skip)
Assertion in data-set failed for "sys_history":
array(
   'actiontype' => '2',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'recuid' => '1',
   'usertype' => 'BE',
   'userid' => '1',
   'tstamp' => '1700000000',
   'history_data' => '{"oldRecord":{"title":"First item","l10n_diffsource":""},"newRecord":{"title":"Changed item","l10n_diffsource":"{\"title\":\"\"}"}}',
   'correlation_id' => '\*'
)

Log of a created record

Deviates

In 14.3

Core: A new item is created in the default language through DataHandler. DataHandler writes one sys_log entry for the new uid 5, with the action "insert" (1), the message "Record {table}:{uid} was inserted on page {pid}" and the page of the item in the log data.

Extbase: Extbase creates the item but writes no sys_log entry.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/LogTest.php:85 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/LogTest.php:104 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Log/CreatedRecord.csv (local)
SkipExtbase differs from core: it writes no sys_log entry.
TestLogTest::logOfACreatedRecordByExtbase (Failure without skip)
Assertion in data-set failed for "sys_log":
array(
   'tstamp' => '1700000000',
   'userid' => '1',
   'type' => '1',
   'action' => '1',
   'error' => '0',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'recuid' => '5',
   'details' => 'Record {table}:{uid} was inserted on page {pid}',
   'log_data' => '{"table":"tx_extbasefacts_domain_model_item","uid":5,"pid":2}',
   'event_pid' => '2',
   'channel' => 'content',
   'level' => 'info'
)

Log of a changed record

Deviates

In 14.3

Core: The title of the English item is changed through DataHandler. DataHandler writes one sys_log entry with the action "update" (2) and the message "Record {table}:{uid} was updated".

Extbase: Extbase changes the item but writes no sys_log entry.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/LogTest.php:129 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/LogTest.php:148 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Log/ChangedRecord.csv (local)
SkipExtbase differs from core: it writes no sys_log entry.
TestLogTest::logOfAChangedRecordByExtbase (Failure without skip)
Assertion in data-set failed for "sys_log":
array(
   'tstamp' => '1700000000',
   'userid' => '1',
   'type' => '1',
   'action' => '2',
   'error' => '0',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'recuid' => '1',
   'details' => 'Record {table}:{uid} was updated',
   'log_data' => '{"table":"tx_extbasefacts_domain_model_item","uid":1,"history":"1"}',
   'event_pid' => '2',
   'channel' => 'content',
   'level' => 'info'
)

Log of a deleted record

Deviates

In 14.3

Core: An English item without translation is deleted through DataHandler. DataHandler writes one sys_log entry with the action "delete" (3) and the message "Record {table}:{uid} was deleted from pages:{pid}".

Extbase: Extbase removes the item but writes no sys_log entry.

Target for 15.x

Extbase behaves as the core.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/LogTest.php:174 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/LogTest.php:193 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Log/DeletedRecord.csv (local)
SkipExtbase differs from core: it writes no sys_log entry.
TestLogTest::logOfADeletedRecordByExtbase (Failure without skip)
Assertion in data-set failed for "sys_log":
array(
   'tstamp' => '1700000000',
   'userid' => '1',
   'type' => '1',
   'action' => '3',
   'error' => '0',
   'tablename' => 'tx_extbasefacts_domain_model_item',
   'recuid' => '3',
   'details' => 'Record {table}:{uid} was deleted from pages:{pid}',
   'log_data' => '{"table":"tx_extbasefacts_domain_model_item","uid":3,"pid":2}',
   'event_pid' => '2',
   'channel' => 'content',
   'level' => 'info'
)

Reference index after adding tags

Same as core

In 14.3

Core: The tags 1 and 2 are attached to item 1 through DataHandler. The reference index holds one row per tag for the field "tags" of item 1, with the position of the tag in the sorting.

Extbase: Extbase updates the reference index to the same two rows for item 1 as DataHandler.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/ReferenceIndexTest.php:86 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/ReferenceIndexTest.php:105 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/ReferenceIndex/AddedTags.csv (local)

Reference index after removing the last tag

Same as core

In 14.3

Core: The only tag of item 4 is detached through DataHandler. The reference index of item 4 was built beforehand and holds no row for item 4 afterwards.

Extbase: Extbase removes the reference index row of item 4, the index is empty afterwards as with DataHandler.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/ReferenceIndexTest.php:129 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/ReferenceIndexTest.php:151 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/ReferenceIndex/RemovedTag.csv (local)

Timestamps of a created record

Same as core

In 14.3

Core: A new item is created through DataHandler. DataHandler sets crdate and tstamp of the new item to the current time and leaves the other items alone.

Extbase: Extbase sets crdate and tstamp of the new item to the current time, as DataHandler does.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/TimestampTest.php:85 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/TimestampTest.php:104 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Timestamp/CreatedRecord.csv (local)

Timestamp of a changed record

Same as core

In 14.3

Core: The title of the English item is changed through DataHandler. DataHandler sets tstamp of the item to the current time and keeps its crdate; the other items keep both columns.

Extbase: Extbase sets tstamp of the changed item to the current time and keeps its crdate, as DataHandler does.

Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/TimestampTest.php:126 (Core) (local)
Testtypo3/sysext/extbase/Tests/Functional/Persistence/Facts/TimestampTest.php:145 (Extbase) (local)
Filetypo3/sysext/extbase/Tests/Functional/Persistence/Facts/Fixtures/Timestamp/ChangedRecord.csv (local)