Issue Bug Closed

#83377Soft Reference Index is broken for files

Sascha Egerer 12/18/17, 17:00 updated 12/23/19, 22:48

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

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.