Bug #80152
closed
Filelist: File can not be deleted if it was reference once
Added by Thorben Nissen over 7 years ago.
Updated over 7 years ago.
Category:
File Abstraction Layer (FAL)
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.
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()
- Status changed from New to Under Review
- 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
- Status changed from Needs Feedback to Under Review
- Has duplicate Bug #80692: Deleting old files fails added
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.
- Related to Bug #81087: Filelist: cannot delete a folder where there is a file that was referenced once added
- 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.
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.
Also available in: Atom
PDF