Skip to content
Snippets Groups Projects
Commit f397539e authored by Garvin Hicking's avatar Garvin Hicking Committed by Georg Ringer
Browse files

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

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)

Resolves: #103915
Related: #101653
Releases: main
Change-Id: Ia42e00b03d1369efe319e41e2b406b5303804854
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84402


Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: default avatarOliver Wand <wand@itaw.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
parent ddf7eede
Branches
Tags
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment