[BUGFIX] Better sys_refindex with workspace mm
This fixes issues regarding sys_refindex handling when dealing with workspace mm relations. Various DataHandler tests run with disabled refindex check after performing mm related operations. All those are enabled now, so all known issues in this area are fixed. The patch touches various areas in DataHandler, ReferenceIndex and RelationHandler to achieve this. The key changes are triggered by a database scenario that is unique for mm relations. Usually, when creating a workspace record or overlay, child record overlays (for instance inline children) are also created in this workspace. For mm records, this can be different: When the local or foreign side of a record is created in a workspace, it does not necessarily mean that a connected opposite side is also created as workspace overlay. This would otherwise create the need for a recursive operation that would basically end up with "everything" being created as workspace overlay. However, mm table entries are created for these relations, leading to a situation that a workspace record can point to a non-workspace record through the mm table. Reference index entries for mm table connections are always handled from the 'local' side. For instance, with categories, 'sys_category' table is the local side, with 'pages', 'tt_content' and others being the foreign side. If now one of the records on the foreign side gets a workspace overlay record, sys_refindex rows of all connected records of the affected local side need to be created. This can lead to the funny situation that we end up with refindex rows that point from a non-workspace to a non-workspace record, but have a non-0 workspace entry. Those additional rows are needed to have "the full set" and proper sorting when looking at refindex of such a relation from the local side. The patch basically handles especially these 'foreign side has a workspace overlay' scenarios, plus the side effects that have to be taken care of when discarding and publishing these records. Additionally, a couple of side effects are tackled: First, the ReferenceIndex->updateIndex() - that's the main logic when running cli referenceindex:update command - is tuned to drop reference index entries related to meanwhile deleted workspaces. This is covered with additional tests and is done now since the code needs to iterate over existing workspaces for local-side mm records that may have workspace overlays on the foreign side. So most of the code had to be created now anyways. RelationHandler->readMM() receives a fix for a long standing bug (Issue #83582, introduced by #57169), to no longer show workspace relations in live when looking at local-side records, for instance when looking at category items in live when one of the connected items has a workspace overlay. Next to lots of comments explaining details in place and referencing the test cases that nail specific scenarios, a couple of @todo's are added to point out things we may want to tackle in the future. All in all, the patch resolves a series of issues that will especially lead to 'categories' being much more reliable in workspaces. Change-Id: I24407f93665852fa761f6fbe6c5ab249473468d2 Related: #57169 Resolves: #83582 Resolves: #96067 Releases: master, 11.5 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72250 Tested-by:core-ci <typo3@b13.com> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/core/Classes/DataHandling/DataHandler.php 37 additions, 4 deletionstypo3/sysext/core/Classes/DataHandling/DataHandler.php
- typo3/sysext/core/Classes/DataHandling/ReferenceIndexUpdater.php 2 additions, 2 deletions...ysext/core/Classes/DataHandling/ReferenceIndexUpdater.php
- typo3/sysext/core/Classes/Database/ReferenceIndex.php 172 additions, 30 deletionstypo3/sysext/core/Classes/Database/ReferenceIndex.php
- typo3/sysext/core/Classes/Database/RelationHandler.php 13 additions, 1 deletiontypo3/sysext/core/Classes/Database/RelationHandler.php
- typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/changeCategoryRelationSorting.csv 1 addition, 0 deletions...nyToMany/Modify/DataSet/changeCategoryRelationSorting.csv
- typo3/sysext/core/Tests/Functional/Database/Fixtures/ReferenceIndex/UpdateIndexRemoveNonExistingWorkspaceImport.csv 16 additions, 0 deletions...enceIndex/UpdateIndexRemoveNonExistingWorkspaceImport.csv
- typo3/sysext/core/Tests/Functional/Database/Fixtures/ReferenceIndex/UpdateIndexRemoveNonExistingWorkspaceResult.csv 14 additions, 0 deletions...enceIndex/UpdateIndexRemoveNonExistingWorkspaceResult.csv
- typo3/sysext/core/Tests/Functional/Database/Fixtures/ReferenceIndex/WorkspaceLoadedUpdateIndexAddsRowsForLocalSideMmHavingForeignWorkspaceRecordImport.csv 32 additions, 0 deletions...sRowsForLocalSideMmHavingForeignWorkspaceRecordImport.csv
- typo3/sysext/core/Tests/Functional/Database/Fixtures/ReferenceIndex/WorkspaceLoadedUpdateIndexAddsRowsForLocalSideMmHavingForeignWorkspaceRecordResult.csv 39 additions, 0 deletions...sRowsForLocalSideMmHavingForeignWorkspaceRecordResult.csv
- typo3/sysext/core/Tests/Functional/Database/Fixtures/ReferenceIndex/WorkspaceLoadedUpdateIndexRemoveNonExistingWorkspaceImport.csv 31 additions, 0 deletions...paceLoadedUpdateIndexRemoveNonExistingWorkspaceImport.csv
- typo3/sysext/core/Tests/Functional/Database/Fixtures/ReferenceIndex/WorkspaceLoadedUpdateIndexRemoveNonExistingWorkspaceResult.csv 26 additions, 0 deletions...paceLoadedUpdateIndexRemoveNonExistingWorkspaceResult.csv
- typo3/sysext/core/Tests/Functional/Database/ReferenceIndexTest.php 39 additions, 0 deletions...ext/core/Tests/Functional/Database/ReferenceIndexTest.php
- typo3/sysext/core/Tests/Functional/Database/ReferenceIndexWorkspaceLoadedTest.php 53 additions, 0 deletions...Functional/Database/ReferenceIndexWorkspaceLoadedTest.php
- typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php 18 additions, 1 deletiontypo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/ActionTest.php 0 additions, 33 deletions.../Functional/DataHandling/ManyToMany/Modify/ActionTest.php
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/addCategoryRelation.csv 8 additions, 0 deletions...andling/ManyToMany/Modify/DataSet/addCategoryRelation.csv
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/changeCategoryRelationSorting.csv 4 additions, 0 deletions...nyToMany/Modify/DataSet/changeCategoryRelationSorting.csv
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/copyContentOfRelation.csv 5 additions, 0 deletions...dling/ManyToMany/Modify/DataSet/copyContentOfRelation.csv
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/copyPage.csv 8 additions, 0 deletions...ional/DataHandling/ManyToMany/Modify/DataSet/copyPage.csv
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/createContentNAddRelation.csv 3 additions, 0 deletions...g/ManyToMany/Modify/DataSet/createContentNAddRelation.csv
Please register or sign in to comment