Thumbnail reference in Media_Field_Data is ignored

Created on 8 November 2022, over 2 years ago
Updated 29 April 2025, 10 days ago

(Thanks for a great module!)

Problem/Motivation

"Used not referenced" report includes thumbnails created by Media module.

(Image type media are exempt because they use the same fid for the field_..._target_id and thumbnail__target_id. Documents and Videos use a different fid in thumbnail__target_id that's not refenced anywhere else.)

When you have a lot of documents or video links, the report becomes crowded.

Steps to reproduce

Install Media module. Create a media field (document) in a node type.
Upload a document to this field.
The "public://media-icons/generic/generic.png" file will be included in the Used Not Referenced report.

If you setup a Remote Video type media, the thumbnail craeted for that video is added to the report.

It would be easy to ignore a few lines on the report, but each document creates a new usage, extending the table row of the generic.png file.

Proposed resolution

In auditfilesUsedNotReferencedGetFileList() compare against thumbnail__target_id column in table media_field_data.

I realise there might be many modules using different columns to access the file table, and impossible for you to cope with them all. Media is one of the core modules that's gaining popularity. (And I believe your module is a must to keep the files directory becoming a junk yard.)

✨ Feature request
Status

Active

Version

4.2

Component

Used not referenced report

Created by

πŸ‡ΉπŸ‡·Turkey cegri

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024