Review main Merged

86847[BUGFIX] Reference correct time fields in cache calculation

Andreas Kienast CR +2 V +2 Easy +1 −1 updated 11/04/24, 09:48

Commit message

The method `CacheLifetimeCalculator::getFirstTimeValueForRecord()`
collects the configured time fields (starttime, endtime) by their actual
field names, which can be different, depending on the TCA.

However, when calculating the value the TCA setting names were used as
field names, which happens to always match within the TYPO3 Core, but
may not in 3rd party extensions.

The method is fixed to use the correct field names to access record
properties.

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Benjamin Franzke +1
    • Thomas Hohn +1
    • Garvin Hicking +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Benjamin Franzke +1
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 78

  1. Andreas Kienast uploaded patch set 1 10/31/24, 14:31

  2. core-ci voted on patch set 1 V +1 10/31/24, 14:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68930

  3. Thomas Hohn voted on patch set 1 CR +1 11/04/24, 07:40

  4. Garvin Hicking commented on patch set 1 CR +1 V +1 11/04/24, 08:20

    This took me a awhile, just making a note: Config: ``` $GLOBALS['TCA']['fe_users']['ctrl']['enablecolumns']['starttime'] = 'starttime'; $GLOBALS['TCA']['tx_myextension_domain_model_mymodel']['ctrl']['enablecolumns']['starttime'] = 'highlander_birthdate'; ``` Code does: ``` $timeFields = []; foreach (['starttime', 'endtime'] as $field) { $timeFields[$field] = $GLOBALS['TCA'][$tableName]['ctrl']['enablecolumns'][$field]; } ``` So: ``` // fe_users: $timeFields['starttime'] = $GLOBALS['TCA']['fe_users']['ctrl']['enablecolumns']['starttime] = 'starttime'; // tx_myextension: $timeFields['starttime'] = $GLOBALS['TCA']['tx_myextension_domain_model_mymodel']['ctrl']['enablecolumns']['starttime] = 'highlander_birthday'; ``` With this patch, for the first case it's always `$timeFields['starttime'] = 'starttime'` but the second case is `$timeFields['starttime'] = 'highlander_birthday';`. So the array key will always will be starttime/endtime, but the array value the actual TCA array value.
  5. Benjamin Franzke voted on patch set 1 CR +1 11/04/24, 09:21

  6. Benjamin Franzke voted on patch set 1 V +1 11/04/24, 09:39

  7. Andreas Kienast voted on patch set 1 CR +2 V +2 11/04/24, 09:39

  8. Andreas Kienast merged patch set 2 11/04/24, 09:48