[TASK] Consider soft delete in file reference delete method
With #102770 the `delete()` method for a FileReference object has been implemented. This was however performed using a hard delete of the file reference record in the database, which is not appropriate, since the delete functionality must take into account, if the table is configured for soft or hard deletes. This patch changes the implementation, so the file reference is either hard or soft deleted depending on the TCA configuration. If the delete operation was successful, the reference index for affected records is now updated. Additionally, functional tests are extended to ensure, that the file used in the file reference remains when the file reference is deleted and that the reference index is updated accordingly. Resolves: #102785 Related: #102770 Releases: main, 12.4 Change-Id: I43beb066c2259441aa2ed7e3fba0e242b7d8fbbb Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85516 Tested-by:core-ci <typo3@b13.com> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/core/Classes/Resource/FileReference.php 32 additions, 8 deletionstypo3/sysext/core/Classes/Resource/FileReference.php
- typo3/sysext/core/Tests/Functional/Resource/FileReferenceTest.php 29 additions, 14 deletions...sext/core/Tests/Functional/Resource/FileReferenceTest.php
- typo3/sysext/core/Tests/Functional/Resource/Fixtures/FileReference.csv 0 additions, 6 deletions...core/Tests/Functional/Resource/Fixtures/FileReference.csv
- typo3/sysext/core/Tests/Functional/Resource/Fixtures/FileReference/FileReference.csv 10 additions, 0 deletions...ctional/Resource/Fixtures/FileReference/FileReference.csv
- typo3/sysext/core/Tests/Functional/Resource/Fixtures/FileReference/FileReferenceHardDelete.csv 7 additions, 0 deletions...source/Fixtures/FileReference/FileReferenceHardDelete.csv
- typo3/sysext/core/Tests/Functional/Resource/Fixtures/FileReference/FileReferenceSoftDelete.csv 8 additions, 0 deletions...source/Fixtures/FileReference/FileReferenceSoftDelete.csv
Please register or sign in to comment