Hi,

the function media_file_delete should as pointed out in the comment within it use the following code

$media = media_load($file->fid);
module_invoke_all('entity_delete', $media, 'media');
field_attach_delete('media', $media);

to delete the attached field data of the entity. The media_browser_plus module for instance uses EntityFieldQuery to load media entities which returns positive hits containing deleted entity_ids if there is still field data that you query against.

I'll add the patch in a few minutes.

CommentFileSizeAuthor
#1 media-1066856.patch843 bytesSebastian.Buesing

Comments

Sebastian.Buesing’s picture

Status: Needs work » Needs review
StatusFileSize
new843 bytes

Attached patch

effulgentsia’s picture

Status: Needs review » Fixed

This is now fixed in 7.x-1.x via the media entity to file entity refactoring in #1086958: Switch from Media Entity to File Entity. That refactoring broke Media Browser Plus, which now needs to be updated accordingly: #1139210: Call to undefined function media_browser_build_media_item() when using media-7.x-1.x-dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.