Project

General

Profile

Actions

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.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2017-03-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

It is not possible to delete files that had been referenced in a record, e.g. a content element. Steps to reproduce:

  1. Upload a file in the file list
  2. Add a new content element (e.g. of type "textmedia") and add this file (and save)
  3. Delete the file (reference) from the content element (and save)
  4. 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.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #81087: Filelist: cannot delete a folder where there is a file that was referenced onceClosed2017-04-29

Actions
Has duplicate TYPO3 Core - Bug #80692: Deleting old files failsClosed2017-04-05

Actions
Actions #1

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()

Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

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

Actions #6

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

Actions #7

Updated by Andreas Allacher over 7 years ago

  • Has duplicate Bug #80692: Deleting old files fails added
Actions #8

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.

Actions #9

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
Actions #10

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.

Actions #11

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.

Actions

Also available in: Atom PDF