Review main Merged

50987[BUGFIX] Delete relations of tables without delete-field

Stephan Großberndt CR +2 V +2 Expert +2495 −5 updated 05/28/25, 16:52

Commit message

In an inline relation, when a parent table is not soft delete
aware, and a parent is deleted (hard delete, DB row removed),
attached children need to be hard deleted as well. Otherwise,
those children would be orphaned.

The change updates the delete handling to reflect this and
adds a bunch of functional tests to verify details.

The patch also reveals there are still issues with hard delete
scenarios when more than one inline child is attached.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 86

Show 66 more files

Review log 76102

Show 6177 earlier messages
  1. Stephan Großberndt uploaded patch set 1 12/16/16, 11:25

  2. TYPO3com voted on patch set 1 V -1 12/16/16, 11:29 Completed build in 03m 55s on Fri, 16 Dec, 12:29 PM Test Summary: 116 of 54391 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5810

  3. Stephan Großberndt uploaded patch set 2 12/16/16, 11:52

  4. TYPO3com voted on patch set 2 V +1 12/16/16, 11:58 Completed build in 05m 45s on Fri, 16 Dec, 12:58 PM Test Summary: 54391 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5816

  5. Stephan Großberndt voted on patch set 2 V -1 12/16/16, 13:02

  6. Stephan Großberndt commented on patch set 2 12/16/16, 14:10

    Does not delete mm relations yet.
  7. Benni Mack commented on patch set 2 09/09/17, 23:20

    What to do here?
  8. Stephan Großberndt commented on patch set 2 09/11/17, 15:30

    First of all: decide what has to happen to MM-records between tables if one side is deleted. Keep the MM records so if undeleting the relations are still there?
  9. Mathias Schreiber commented on patch set 2 03/01/18, 21:08

    can you provide a bit of TCA here or at least define the cases?
  10. Stephan Großberndt commented on patch set 2 03/02/18, 10:21

  11. Benni Mack commented on patch set 2 10/01/18, 18:04

    Decision: We keep them :)
  12. Benni Mack abandoned the change 10/27/18, 15:15

    Stephan, I'll abandon this one for now. Hope that's ok. If not, let me know.
  13. Stephan Großberndt restored the change 10/27/18, 15:23

  14. Stephan Großberndt wrote 10/27/18, 15:24

    Removed Verified-1 by Stephan Großberndt <stephan.grossberndt@typo3.org>
  15. Stephan Großberndt updated the commit message in patch set 3 10/27/18, 15:25

  16. TYPO3com voted on patch set 3 V -1 10/27/18, 15:25 Completed build in 07s on Sat, 27 Oct, 05:25 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-29680

  17. Stephan Großberndt uploaded patch set 4 02/18/19, 09:09

  18. TYPO3com voted on patch set 4 V -1 02/18/19, 09:09 Completed build in 15s on Mon, 18 Feb, 10:09 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32274

  19. Stephan Großberndt marked it work in progress 02/18/19, 09:09

  20. Stephan Großberndt uploaded patch set 5 02/18/19, 09:10

  21. Stephan Großberndt marked it work in progress 02/18/19, 09:12

  22. TYPO3com voted on patch set 5 V +1 02/18/19, 09:26 Completed build in 13m 50s on Mon, 18 Feb, 10:26 AM Test Summary: 46581 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32276

  23. Oliver Klee updated the commit message in patch set 6 02/18/19, 11:21

  24. TYPO3com voted on patch set 6 V +1 02/18/19, 11:34 Completed build in 12m 22s on Mon, 18 Feb, 12:33 PM Test Summary: 46581 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32278

  25. Stephan Großberndt updated the commit message in patch set 7 02/18/19, 11:51

  26. Stephan Großberndt commented on patch set 7 02/18/19, 11:52

    Definitely not for 8.7 (important and security bugfixes only)
  27. TYPO3com voted on patch set 7 V +1 02/18/19, 12:03 Completed build in 11m 37s on Mon, 18 Feb, 01:03 PM Test Summary: 46581 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32279

  28. Stephan Großberndt updated the commit message in patch set 8 03/17/19, 17:53

  29. Stephan Großberndt wrote 03/17/19, 17:54

    Description "Edit commit message" removed
  30. Stephan Großberndt wrote 03/17/19, 17:54

    Description set to "Edit commit message"
  31. TYPO3com voted on patch set 8 V +1 03/17/19, 18:03 Completed build in 09m 54s on Sun, 17 Mar, 07:03 PM Test Summary: 47201 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32827

  32. Markus Klein voted on patch set 8 V +1 CR +1 08/01/19, 07:43

  33. Tymoteusz Motylewski commented on patch set 8 08/02/19, 05:21

    Can we please have some functional tests for this case?
  34. Tymoteusz Motylewski commented on patch set 8 08/02/19, 05:21

    This change is ready for review.
  35. Richard Haeser voted on patch set 8 CR +1 09/07/19, 07:06

  36. Oliver Klee commented on patch set 8 09/07/19, 08:59

    DataHandler.php:4695

    If I read the code correctly, $deleteField will be either 0 or 1. So this line should be this instead, I suppose: if ($deleteField === 0) {
  37. Stephan Großberndt commented on patch set 8 09/09/19, 08:58

    DataHandler.php:4695 Reply

    No, `$GLOBALS['TCA'][$table]['ctrl']['delete']` this is no a value of 0/1 but a string containing the column name which defines as the column storing the delete-status: https://docs.typo3.org/m/typo3/reference-tca/master/en-us/Ctrl/Index.html#delete
  38. Oliver Klee commented on patch set 8 09/09/19, 11:07

    DataHandler.php:4695 Reply

    Ah, I see. Then the comparison should be !== ''.
  39. Stephan Großberndt commented on patch set 8 09/09/19, 15:00

    DataHandler.php:4695 Reply

    No. This is about the case if there is NO delete column defined, so I guess you meant ($deleteField === '') - but this would be wrong too. Usually in TCA the ['ctrl']['delete'] subarray does not even exist if no delete column is defined. So even if I would add a strict comparison to NULL to catch that what about (unlikely but possible) $GLOBALS['TCA'][$table]['ctrl']['delete'] = ''; $GLOBALS['TCA'][$table]['ctrl']['delete'] = NULL; or $GLOBALS['TCA'][$table]['ctrl']['delete'] = 0; Simply negating the value catches all those cases without explicitly specifing all variants.
  40. Sascha Rademacher voted on patch set 8 CR +1 10/10/19, 11:47

  41. Susi Moog voted on patch set 8 CR +1 11/09/19, 15:49

  42. Benni Mack uploaded patch set 9 11/09/19, 16:20

  43. Benni Mack commented on patch set 9 V +1 CR -2 11/09/19, 16:21

    Added tests. Works as expected! Thanks! I'd like to have Olly Hader look over the tests though, blocked until then.
  44. TYPO3com voted on patch set 9 V -1 11/09/19, 16:30 Completed build in 09m 27s on Sat, 9 Nov, 04:30 PM Test Summary: 3 of 48645 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38203

  45. Benni Mack uploaded patch set 10 11/09/19, 17:32

  46. TYPO3com voted on patch set 10 V +1 11/09/19, 17:42 Completed build in 10m 24s on Sat, 9 Nov, 05:42 PM Test Summary: 48299 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38215

  47. Ursula Klinger commented on patch set 10 11/11/19, 18:29

    DataHandler.php:4734

    Why do you check deletedField? when a hard delete is made in the elseif case, I would also call deleteRecord_procFields to delete the related records.
  48. Stephan Großberndt commented on patch set 10 11/12/19, 10:31

    DataHandler.php:4734 Reply

    This patch was meant to only change the behaviour for tables which do NOT have a $deleteField defined. $deleteField contains the value of `$GLOBALS['TCA'][$table]['ctrl']['delete']` which is a string containing the column name which defines as the column storing the delete-status: https://docs.typo3.org/m/typo3/reference-tca/master/en-us/Ctrl/Index.html#delete Hard deleting of records in tables which have a defined $deleteField is not done at all in DataHandler. If there is a $deleteField defined for a table, records are always set to value `1` in the $deleteField and may be hard deleted in recycler or via cronjobs.
  49. Oliver Hader commented on patch set 10 11/19/19, 10:55

    Nice, thanks for providing test-cases here. The `undelete` case is currently not covered with tests at all - which should be done before we can continue with this change here...
  50. Benni Mack wrote 04/06/20, 09:44

    Topic set to DataHandler
  51. Benni Mack updated the commit message in patch set 11 05/25/20, 18:46

  52. TYPO3com voted on patch set 11 V +1 08/11/20, 08:46 Completed build in 11m 38s on Tue, 11 Aug, 08:46 AM Test Summary: 72998 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4564

  53. Stephan Großberndt rebased onto patch set 12 11/23/20, 12:03

  54. TYPO3com voted on patch set 12 V -1 11/23/20, 14:09 Completed build in 13m 14s on Mon, 23 Nov, 02:09 PM Test Summary: 9 of 32641 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7515

  55. Benni Mack updated the commit message in patch set 13 11/18/21, 10:37

  56. Benni Mack wrote 11/29/21, 10:17

    Change destination moved from master to main
  57. Benni Mack updated the commit message in patch set 14 11/29/21, 14:08

  58. Oliver Klee wrote 11/29/21, 14:19

    Removed cc Oliver Klee.
  59. Christian Kuhn commented on patch set 14 02/04/23, 10:49

    is this still an issue? we had a series of changes in DH delete handling in v11, so this may be fixed already?
  60. Markus Klein commented on patch set 14 02/05/23, 00:15

    Reply

    Will check
  61. Markus Klein commented on patch set 14 02/06/23, 19:42

    Reply

    Bug still existing!
  62. Benni Mack updated the commit message in patch set 15 05/03/23, 09:30

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR is:MIN")
  63. Markus Klein commented on patch set 15 CR +1 09/12/24, 06:51

    DataHandler.php:4734 Reply

    Done
  64. Benni Mack updated the commit message in patch set 16 CR +1 10/18/24, 13:49

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  65. Christian Kuhn commented on patch set 16 02/05/25, 19:27

    up. i stumbled upon the same question when reading DH delete code. i'm currently refactoring DH delete and will hopefully pick this up soon.
  66. Benni Mack uploaded patch set 17 04/16/25, 14:17

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  67. Benni Mack voted on patch set 17 CR 0 04/16/25, 14:19

  68. core-ci voted on patch set 17 V -1 04/16/25, 14:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77842

  69. Benni Mack uploaded patch set 18 V -1 04/16/25, 14:34

  70. core-ci voted on patch set 18 V +1 04/16/25, 14:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77844

  71. Benni Mack commented on patch set 18 04/16/25, 14:46

    I have a feeling this change is not complete, (I have a few todos, because relations are not removed properly), but at least we have all tests and an updated MR
  72. Christian Kuhn commented on patch set 18 05/22/25, 15:01

    i'm looking at a related scenario: forceDelete = true with https://review.typo3.org/c/Packages/TYPO3.CMS/+/89497. i think we should pick this change up when the other one is done.
  73. Christian Kuhn uploaded patch set 19 V +1 05/27/25, 16:27

  74. core-ci voted on patch set 19 V -1 05/27/25, 16:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79584

  75. Christian Kuhn commented on patch set 19 05/28/25, 08:19

    Reply

    Done
  76. Christian Kuhn uploaded patch set 20 V -1 05/28/25, 09:15

  77. core-ci voted on patch set 20 V -1 05/28/25, 09:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79618

  1. Christian Kuhn uploaded patch set 21 V -1 05/28/25, 09:57

  2. core-ci voted on patch set 21 V -1 05/28/25, 10:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79627

  3. Christian Kuhn uploaded patch set 22 V -1 05/28/25, 10:14

  4. core-ci voted on patch set 22 V -1 05/28/25, 10:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79630

  5. Christian Kuhn uploaded patch set 23 V -1 05/28/25, 10:36

  6. Christian Kuhn uploaded patch set 24 05/28/25, 10:39

  7. Christian Kuhn uploaded patch set 25 05/28/25, 10:45

  8. core-ci voted on patch set 23 V -1 05/28/25, 10:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79632

  9. Christian Kuhn uploaded patch set 26 05/28/25, 10:49

  10. core-ci voted on patch set 24 V -1 05/28/25, 10:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79633

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

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

  13. Christian Kuhn uploaded patch set 27 V +1 05/28/25, 12:04

  14. core-ci voted on patch set 27 V +1 05/28/25, 12:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79639

  15. Christian Kuhn uploaded patch set 28 V +1 05/28/25, 13:59

  16. core-ci voted on patch set 28 V -1 05/28/25, 14:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79645

  17. Christian Kuhn uploaded patch set 29 V -1 05/28/25, 15:27

  18. Christian Kuhn updated the commit message in patch set 30 05/28/25, 15:33

  19. Christian Kuhn voted on patch set 30 CR +1 V +1 05/28/25, 15:33

  20. core-ci voted on patch set 29 V +1 05/28/25, 15:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79650

  21. core-ci voted on patch set 30 V +1 05/28/25, 15:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79652

  22. Benni Mack voted on patch set 30 CR +1 V +1 05/28/25, 15:58

  23. Stefan Bürk voted on patch set 30 CR +1 V +1 05/28/25, 16:20

  24. Christian Kuhn voted on patch set 30 CR +2 V +2 05/28/25, 16:51

  25. Christian Kuhn merged patch set 31 05/28/25, 16:52