Bug #83377

Soft Reference Index is broken for files

Added by Sascha Egerer over 1 year ago. Updated over 1 year ago.

Status:
Accepted
Priority:
Must have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2017-12-18
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

The reference index build for files via the soft reference indexer is broken.
The reference index entry is created with type _FILE and the ref_string is filled up with the uid of the sys_file record.

How to reproduce:
  1. Create a Text Media Content element
  2. Add a text and link it to a file
  3. Run cleanup:missingfiels
    vendor/bin/typo3 cleanup:missingfiles --update-refindex
    
    Find all file references from records pointing to a missing (non-existing) file.
    ================================================================================
    
     ! [NOTE] Finding missing files referenced by TYPO3 requires a clean reference index (sys_refindex)                     
    
     ! [NOTE] Found 1 soft-referenced files that need manual repair.                                                        
    
     * 108 - f9165d6906bdd2e6a6ea39f3f05a6957 - tt_content:9:bodytext::typolink_tag
    
    *******************************************
    Reference Index being Updated
    *******************************************
    3258 records from 102 tables were checked/updated.
    Index Integrity was perfect!
    

The reference index will always be broken as the indexer tries to resolve the file path (ref_string) which is the id. So the missingfiles task will always report an error as it tries to find file is_file(PATH_site . 108).

IMO the whole _FILE stuff can be dropped from the reference index as there is only FAL from version 8. So all reference index stuff could be build based on database records. Removing all the _FILE stuff will end up in normal databse relation checks which give the expected result as a file is internally also a database record (sys_file). Storing the file path and checking if that path is available does not really makes sense IMO if using a file abstraction layer.

Another option would be so create the refindex the same way as a native field does it.
If a link is created in a native link field (no soft ref index) the entry is created as type "_STRING" and the "ref_string" contains the "typolink".

hash                                    tablename    recuid  field           flexpointer     softref_key     softref_id                          sorting    deleted    workspace    ref_table    ref_uid    ref_string
81fbe3b5f0f7195cbd7f27fea2c992c9        tt_content   9       header_link                     typolink        42d061dbe8503a03e71e5e002ed94c3a:0  -1         0          0            _STRING      0          t3://file?uid=108
f9165d6906bdd2e6a6ea39f3f05a6957        tt_content   9       bodytext                        typolink_tag    9                                   -1         0          0            _FILE        0          108

no_ref_deletable.png View (32.8 KB) taywa gmbh, 2018-01-03 17:25

reference_info_asset.png View (51.4 KB) taywa gmbh, 2018-01-03 17:34


Related issues

Related to TYPO3 Core - Bug #81831: sys_refindex and bodytext columns: link reference to files not working Closed 2017-07-11

History

#1 Updated by Sascha Egerer over 1 year ago

  • Description updated (diff)

#2 Updated by taywa gmbh over 1 year ago

Users are trained that they can delete non referenced files, because they think they are unused. If they do, no warning is showing up resulting in silent remove of file links in a content. Thats not what we want.

If have got 1630 files!

! [NOTE] Found 1630 soft-referenced files that need manual repair.                                                     

 * 583 - 002018900567c643e1444c3c98b24889 - tt_content:1649:bodytext::typolink_tag

#3 Updated by taywa gmbh over 1 year ago

  • Related to Bug #81831: sys_refindex and bodytext columns: link reference to files not working added

#4 Updated by Oliver Hader over 1 year ago

  • Status changed from New to Accepted

Also available in: Atom PDF