Bug #80152
closedFilelist: File can not be deleted if it was reference once
0%
Description
It is not possible to delete files that had been referenced in a record, e.g. a content element. Steps to reproduce:
- Upload a file in the file list
- Add a new content element (e.g. of type "textmedia") and add this file (and save)
- Delete the file (reference) from the content element (and save)
- Try to delete the file in the file list
The file is not removed but a warning is shown:
File not deleted The file cannot be deleted since it is still used at the following places: [record:tt_content:15943]
I tried this with 8.6.0 and the current master. Both the same behaviour.
This happens because deleted file references are considered in the checks in the ExtendedFileUtility. Whether the sys_refindex must be updated when deleting a file reference or the deleted file reference must be ignored on the process in ExtendedFileUtility.
Updated by Andreas Allacher over 7 years ago
The issue is that the check there is using DeletedRestriction
However, sys_refindex doesn't have a TCA configuration and therefore the deleted check needs to be added manually.
Also makeRef does not call getRestrictions()->removeAll()
Updated by Gerrit Code Review over 7 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51988
Updated by Gerrit Code Review over 7 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51988
Updated by Gerrit Code Review over 7 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51988
Updated by Riccardo De Contardi over 7 years ago
- Status changed from Under Review to Needs Feedback
I am not able to reproduce it on the current master with the instruction provided on the ticket description.
Could you check it again? Has it been solved in the meanwhile? Thank you
Updated by Gerrit Code Review over 7 years ago
- Status changed from Needs Feedback to Under Review
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51988
Updated by Andreas Allacher over 7 years ago
- Has duplicate Bug #80692: Deleting old files fails added
Updated by Andreas Allacher over 7 years ago
The bugfix for issue #80692 fixes the delete of file bug.
However, if you have a folder with one file in it and follow the instructions above
BUT DO NOT DELETE the file.
Instead if one tries to delete the folder the check should still fail as the check for folderHasFilesInUse still doesn't include the delete check.
Just not sure if we shouldn't create a different ticket for that issue.
Updated by Riccardo De Contardi over 7 years ago
- Related to Bug #81087: Filelist: cannot delete a folder where there is a file that was referenced once added
Updated by Mona Muzaffar over 7 years ago
- Status changed from Under Review to Closed
I am closing this ticket in favor of creating a new ticket with an updated description of the problem.
(Riccardo already created one: #81087, see related issue)
Thank you Andreas, please add your patch and continue your work on the other ticket.
Updated by Andreas Allacher over 7 years ago
One more thing. When I created my original patch I checked all queries to ref_index and there was one point where I wasn't sure if it could be a problem or not, so I just modified it:
https://review.typo3.org/#/c/51988/4/typo3/sysext/filelist/Classes/FileList.php
Here the restrictions are not removed in makeRef.
Not sure, it this will be an issue or not. Might be if someone sets restrictions to ref_index prior to the call to makeRef which is unlikely but probably not impossible.