Bug #64253
closedFix incorrect calculation of file references in workspaces
Added by Michael Schams over 9 years ago. Updated almost 7 years ago.
100%
Description
The reference index of files seems to be calculated wrong (or some clones from a content record are not deleted properly), when someone pushes a change from one workspace to another. For example: DRAFT to LIVE or LIVE to DRAFT.
This results in a situation, where backend users (editors as well as administrators) are unable to delete files, because TYPO3 refuses to delete a file if there are still references to.
An administrator user can "fix" the error by re-indexing the reference index, if the change has been pushed from LIVE to DRAFT workspace, but not the other way round (DRAFT to LIVE).
The issue is reproducible when adding an image using content element "Text & Image" (tab: Images).
The behaviour is similar but different when adding links to files in the RTE.
Updated by Michael Schams over 9 years ago
How to reproduce¶
Preparation¶
cd /var/www wget get.typo3.org/6.2 tar xzf typo3_src-6.2.8.tar.gz mkdir htdocs cd htdocs/ ln -s ../typo3_src-6.2.8 typo3_src ln -s typo3_src/typo3 ln -s typo3_src/index.php touch FIRST_INSTALL cd .. chown -Rh www-data:www-data htdocs typo3_src-6.2.8 service apache2 restart
Install TYPO3 (standard installation), do NOT download list of distributions.
Open the backend -> Login as "admin"
Go to: ADMIN TOOLS -> Extension Manager
Search for "workspaces" -> activate
Reload backend
In page tree: create new standard page (becomes UID: 1) -> enable page
Go to: WEB -> List -> "New TYPO3 site" (UID: 0) -> create new record -> choose "Workspace"
- Tab: General
- Title: DRAFT
- Tab: Users
- Owners: select user "admin"
Leave everything else untouched.
Click icon "Save and close document"
Reload backend
Go to: FILE -> Filelist -> navigate to folder "user_upload"
Upload an image into this folder
Scenario 1¶
Go to: WEB -> Page -> choose new page created (UID: 1)
Add a new content element "Text & Images" in column "Normal"
- Tab: General
- leave everything empty
- Tab: Images
- click button "Add image" (popup appears)
- choose uploaded image (image appears as a thumbnail image)
Click icon "Save and close document"
Go to: FILE -> Filelist -> folder "user_upload"
Column "Ref" shows 1 reference of this file (that is correct)
Switch to DRAFT workspace.
Go to: WEB -> Page -> choose page (UID: 1)
Edit content element -> in tab "Images" -> remove image (tooltip: "Delete record (!)")
Are you sure you want to delete this record? -> OK (image disappears)
Click icon "Save and close document"
Go to: FILE -> Filelist -> folder "user_upload"
Column "Ref" shows 3 references of this file (this looks suspicious)
Go to: WEB -> workspaces
list of changes contains latest update
tick checkbox left-hand-side of the record
select "Publish to LIVE" (dropdown box "choose action" at the bottom of the page)
popup "Send to stage" appears -> leave all fields empty -> click "OK"
Go to: FILE -> Filelist -> folder "user_upload"
Column "Ref" shows 1 reference of this file (WRONG!)
This is wrong, because the image has been deleted in the step above.
More precisely, the reference to the file has been deleted.
The image does not exist on any pages.
Not in the DRAFT workspace, not in the LIVE workspace.
An attempt to delete the file in the Filelist results in the Flash error:
File not deleted. The file cannot be deleted since it is still used at the following places:
...and it shows the content element which had the image.
Switch to LIVE workspace.
Go to: SYSTEM -> DB check
Select "Manage Reference Index" from the dropdown box at the top
Click button "Check reference index"
48 records from 29 tables were checked/updated. Record sys_file:1 had 1 added indexes and 0 deleted indexes Record sys_file_metadata:1 had 1 added indexes and 0 deleted indexes Record sys_file_reference:1 had 1 added indexes and 1 deleted indexes Record sys_file_reference:2 had 1 added indexes and 0 deleted indexes Record tt_content:1 had 0 added indexes and 1 deleted indexes
Click button "Update reference index"
-> (same result as above)
Click button "Check reference index"
48 records from 29 tables were checked/updated. Index Integrity was perfect!
Go to: FILE -> Filelist -> folder "user_upload"
Column "Ref" shows 0 references of this file (and file can be deleted)
Scenarion 2¶
Switch to DRAFT workspace.
Go to: WEB -> Page -> choose page (UID: 1)
Edit content element -> tab "Images" -> add image (as before)
Click icon "Save and close document"
Go to: FILE -> Filelist -> folder "user_upload"
Column "Ref" shows 2 references of this file (this looks suspicious)
Go to: WEB -> Workspaces
list of changes contains latest update
tick checkbox left-hand-side of the record
select "Publish to LIVE" (dropdown box "choose action" at the bottom of the page)
popup "Send to stage" appears -> leave all fields empty -> click "OK"
Go to: FILE -> Filelist -> folder "user_upload"
Column "Ref" shows 1 reference of this file
Switch to LIVE workspace.
Go to: WEB -> Page -> choose page (UID: 1)
Edit content element -> in tab "Images" -> remove image (tooltip: "Delete record (!)")
Are you sure you want to delete this record? -> OK (image disappears)
Click icon "Save and close document"
Go to: FILE -> Filelist -> folder "user_upload"
Column "Ref" shows 1 reference of this file (WRONG!)
Stay in LIVE workspace.
Go to: SYSTEM -> DB check
Select "Manage Reference Index" from the dropdown box at the top
Click button "Check reference index"
77 records from 29 tables were checked/updated. Record tt_content:1 had 0 added indexes and 1 deleted indexes
Click button "Update reference index" and "check" again.
Index Integrity was perfect!
Go to: FILE -> Filelist -> folder "user_upload"
Column "Ref" shows 1 reference of this file (WRONG!)
Updated by Mathias Schreiber over 9 years ago
- Category set to File Abstraction Layer (FAL)
- Target version set to 7.1 (Cleanup)
- Sprint Focus set to On Location Sprint
Updated by Gerrit Code Review over 9 years ago
- Status changed from New to Under Review
Patch set 1 for branch TYPO3_7-0 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36043
Updated by Gerrit Code Review over 9 years ago
Patch set 2 for branch TYPO3_7-0 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36043
Updated by Gerrit Code Review over 9 years ago
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36044
Updated by Gerrit Code Review over 9 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36044
Updated by Gerrit Code Review over 9 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36044
Updated by Gerrit Code Review over 9 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36044
Updated by Gerrit Code Review over 9 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36044
Updated by Gerrit Code Review over 9 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36044
Updated by Gerrit Code Review over 9 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36481
Updated by Markus Klösges over 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset abee33c5a35a23a9aec8234b73952a33ff8eb8b2.
Updated by Gerrit Code Review over 9 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36481
Updated by Markus Klösges over 9 years ago
- Status changed from Under Review to Resolved
Applied in changeset b66a0f09da2fb6f2890a5dd5e0fa92e0880d681a.
Updated by Anja Leichsenring over 8 years ago
- Sprint Focus deleted (
On Location Sprint)
Updated by Riccardo De Contardi almost 7 years ago
- Status changed from Resolved to Closed