Review 13.4 Merged

89520[BUGFIX] Improve recycler hard delete DB consistency

Christian Kuhn CR +2 V +2 Hard +278 −101 updated 05/26/25, 10:18

Commit message

This change looks at some details in DataHandler when records are
hard-deleted - when (typically already soft-deleted) records
are removed from DB using the recycler.

These scenarios are fixed:

* When records having "true" MM relations are soft-deleted, the
  relations are kept in the MM table. This is done to allow "undelete"
  of such records and getting the MM relations "back" as well.
  However, when hard-deleting a local or foreign side record, the
  connected MM rows need to be removed. The patch takes care and
  supports the fix with tests.
* When hard-deleting default language pages, existing localized page
  versions of that page must be removed as well. This is important to
  retain DB consistency since otherwise the localized pages are left
  orphaned. The patch takes care and adds tests.
* Similar to the above scenario, any existing sub page DB rows must be
  removed (along with records on them) when a parent page is hard
  deleted, otherwise the rootline of sub pages is broken. Fix and add
  tests.

The patch refactors a detail in DataHandler to achieve this: DataHandler
has a fishy "disableDeleteClause" toggle to make it fetch soft-deleted
records as well. This is only used within the recycler, which
additionally uses the $forceHardDelete toggle on deleteAction().
disableDeleteClause is used very inconsistently within DataHandler - it
should usually only belong to the 'delete' code path, but is also use
elsewhere. This makes everything more complicated than it should be.
Together with the fact that $forceHardDelete already tells DataHandler
to ignore soft-delete, "disableDeleteClause" is more of a burden than
help. Since that toggle is only actively used by ext:recycler and
probably does more harm than good when used in different code paths than
"delete", it is fully removed now. Note the v13 backport of the patch
keeps disableDeleteClause() as no-op method.

Note these forced hard-delete recycler scenarios are similar to
delete scenarios when tables are not soft-delete aware which has a
couple of issues as well. This is covered by #79014 which could have
a more detailed look as well, after lots of the delete code path has
been streamlined and disentangled with #106631.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
  • Verified V +2 Done
    • Christian Kuhn +2
    • core-ci +1 CI

Issues 5

Files 12

Review log 34

  1. Christian Kuhn uploaded patch set 1 05/26/25, 10:02

  2. core-ci voted on patch set 1 V +1 05/26/25, 10:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79476

  3. Christian Kuhn voted on patch set 1 CR +2 V +2 05/26/25, 10:18

  4. Christian Kuhn merged patch set 2 05/26/25, 10:18