Review main Merged

84402[BUGFIX] Respect TCA "check" default for auto-create DB fields

Garvin Hicking CR +2 V +2 Normal +167 −4 updated 05/26/24, 07:33

Commit message

Change #101653 introduced the auto-creation of DB fields for TCA
type "check", but used a hardcoded "0" as default.

Since TCA definitions might define a different default, and
records may not always be created using the DataHandler to
respect TCA defaults, this can lead to DB entries getting
created with an unexpected default setting.

IMPORTANT: This patch only fixes the root cause of the bug.
If an existing v13 installation has already created new
records after the DB migration wizard update in 13.0, all
records may have wrong defaults. Check the contents of
your database for the fields listed below and apply
manual adjustments as needed (for example, record storages
having "auto_extract_metadata"=1 instead of 0).

An example symptom of this is the auto-creation of a
file storage record, which uses the QueryBuilder to
create a record, without specifying the whole list
of all possible fields. For example then leading to
added YouTube media files not auto-creating metadata
records.

This patch uses the proper evaluation of the TCA
"default" setting of an auto-created field.

In TYPO3 Core this only affected `be_users.options` and
`sys_file_storage.auto_extract_metadata` default record
creation. The latter field has now been included
to the default record creation as a fixed value like
the others. A follow-up patch could rewrite this
functionality using the DataHandler or QueryBuilder
default value injection.

Tests have been created to verify this regression,
existing tests for be_user creation have been
adapted for the proper default values.

Executing the DB schema analyzer will now
adjust the following fields:

* be_users.options                                 (0->3)
* sys_file_storage.is_browsable                    (0->1)
* sys_file_storage.is_writable                     (0->1)
* sys_file_storage.is_online                       (0->1)
* sys_file_storage.auto_extract_metadata           (0->1)
* sys_file_metadata.visible                        (0->1)
* tt_content.sectionIndex                          (0->1)
* tx_styleguide_palette.palette_1_1                (0->1)
* tx_styleguide_palette.palette_1_3                (0->1)
* tx_styleguide_valuesdefault.checkbox_1           (0->1)
* tx_styleguide_valuesdefault.checkbox_2           (0->1)
* tx_styleguide_valuesdefault.checkbox_3           (0->5)
* tx_styleguide_valuesdefault.checkbox_4           (0->5)
* sys_workspace.edit_allow_notificaton_settings    (0->3)
* sys_workspace.edit_notification_preselection     (0->2)
* sys_workspace.publish_allow_notificaton_settings (0->3)
* sys_workspace.publish_notification_preselection  (0->1)
* sys_workspace.execute_allow_notificaton_settings (0->3)
* sys_workspace.execute_notification_preselection  (0->3)
* sys_workspace_stage.allow_notificaton_settings   (0->3)
* sys_workspace_stage.notification_preselection    (0->8)

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Oliver Wand +1
    • Anja Leichsenring +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Anja Leichsenring +1
    • core-ci +1 CI

Issues 2

Files 7

Review log 1117

  1. Garvin Hicking uploaded patch set 1 05/25/24, 19:54

  2. core-ci voted on patch set 1 V -1 05/25/24, 20:00 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58225

  3. Garvin Hicking uploaded patch set 2 V -1 05/25/24, 20:41

    Important rst file and test adjustment
  4. core-ci voted on patch set 2 V -1 05/25/24, 20:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58226

  5. Garvin Hicking uploaded patch set 3 V -1 05/25/24, 21:00

    Add regression test to verify patch
  6. core-ci voted on patch set 3 V +1 05/25/24, 21:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58227

  7. Garvin Hicking updated the commit message in patch set 4 V +1 05/25/24, 21:11

  8. core-ci voted on patch set 4 V +1 05/25/24, 21:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58228

  9. Stefan Bürk updated the commit message in patch set 5 V +1 05/25/24, 21:23

  10. Stefan Bürk rebased onto patch set 6 05/25/24, 21:24

  11. core-ci voted on patch set 5 V +1 05/25/24, 21:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58229

  12. core-ci voted on patch set 6 V +1 05/25/24, 21:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/58230

  13. Stefan Bürk voted on patch set 6 CR +1 05/25/24, 21:41

  14. Oliver Wand voted on patch set 6 CR +1 05/25/24, 21:46

  15. Anja Leichsenring voted on patch set 6 CR +1 V +1 05/26/24, 05:26

  16. Georg Ringer voted on patch set 6 CR +2 V +2 05/26/24, 07:33

  17. Georg Ringer merged patch set 7 05/26/24, 07:33