sys_refindex and bodytext columns: link reference to files not working
It seems that references in the Filelist for files referenced in any bodytext column are not working anymore in typo3 8.7.x. I even tried with the latest release 8.7.3.
I attached an image that you can see the PDF file-example.pdf has no Ref although the file is linked in a text element (in a bodytext field). It used to show the number of times it was referenced.
I tried in a clean installation and it also doesn't work, so I think this a bug. This was helpful to know if the file is being linked anywhere in the website.
Updated by Franz Kugelmann over 6 years ago
I can confirm, too. The reason is that the code for creating the Link to the references in FileList::makeRef is checking only for entries in sys_refindex with ref_table='sys_file'. Since 8 however, for links in bodytext and i.e. header field to files from filelist there are new keywords "_FILE" and "_STRING" introduced. You can easily check this by truncating table sys_refindex and creating such file references in an textmedia content element.
I guess the code in FileList::makeRef needs to be adapted to take also "_FILE" and "_STRING" into account. Not sure about side effects or if such references would correctly be shown however.
Updated by Leonie Philine about 6 years ago
I can also confirm this bug.
The sys_refindex contains entries with
= 0 and
ref_string being the
\TYPO3\CMS\Filelist\FileList::makeRef() only counts entries with
ref_uid being the
sys_file uid - instead of
The CURRENTLY correct (but indeed broken) way (watch out - here we have duplicated code!) is implemented here:
\TYPO3\CMS\Backend\Utility\BackendUtility::referenceCount(). As a workaround,
\TYPO3\CMS\Filelist\FileList::makeRef() could make use of this @BackendUtility method.
(Still must be used with parameter
$table='_FILE' - then ref_string is used rather than
ref_uid for file (soft)reference count.)
Of course it would be more correct to use
sys_file database relations instead of the
_FILE hack with
sys_file uids being stored in
I hope that https://review.typo3.org/#/c/55158/ lands soon!