Skip to content
  • Christian Kuhn's avatar
    [BUGFIX] Separate 'delete' and 'discard' in DataHandler · 01e2c1e6
    Christian Kuhn authored
    There are 4 "drop record" scenarios in workspaces:
    * Delete a new or changed record in list/page module
    * Create a delete placeholder in list/page module to mark a
      live record as to-be-deleted on workspace publish
    * Discard (throw away) a change in workspace module
    * Flush all workspace changes by deleting a sys_workspace
      record.
    
    All these scenarios are handled with the same DataHandler
    code which leads to tons of bugs since especially
    "delete & create delete placeholder" compared to
    "discard & flush" are logically different things.
    
    The patch separates discard and flush to a new codebase.
    First patch sets started with a 1:1 copy of the delete code,
    then carefully refactored the code to its final state. The
    roughly 850 lines of delete code are streamlined to about
    300 lines for discard and flush. The code is much easier
    to follow, recursions are simplified and access checks are
    in one place.
    
    Discard previously created a mixture of hard and soft deleted
    records in the database, leading to a huge mess. This changed:
    Discard now always means that records are dropped from database.
    
    The discard code now properly cascades down into relations,
    solving tons of bugs along the way. The functional DataHandler
    tests are refactored and heavily extended to cover discard.
    Two previously existing issues are not fixed yet: ManyToMany
    relations are not properly cleaned up on discard, and discarding
    does not fully follow localization overlays in 'connected' mode.
    Those scenarios are marked with @todo's in the .csv files and
    should be relatively easy to solve with dedicated single patches.
    
    Change-Id: Ie33dd2bdc333a4d8ed9314b7520212cc11942c89
    Resolves: #85778
    Resolves: #92336
    Releases: master, 10.4
    Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65638
    
    
    Tested-by: default avatarTYPO3com <noreply@typo3.com>
    Tested-by: default avatarOliver Bartsch <bo@cedev.de>
    Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
    Tested-by: default avatarBenni Mack <benni@typo3.org>
    Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
    Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
    Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
    Reviewed-by: default avatarBenni Mack <benni@typo3.org>
    Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
    01e2c1e6