1 file.file.inc | file_file_delete($file) |
Implements hook_file_delete().
File
- core/
modules/ file/ file.file.inc, line 110 - File hooks implemented by the File module.
Code
function file_file_delete($file) {
field_attach_delete('file', $file);
// This is safe to call since the file's records from the usage table have
// not yet been deleted.
file_invalidate_field_caches($file);
// Remove file metadata.
db_delete('file_metadata')->condition('fid', $file->fid)->execute();
// Remove this file from the search index if needed.
// This code is implemented in file entity module rather than in search
// module because file entity is implementing search module's API, not the
// other way around.
if (module_exists('search')) {
search_reindex($file->fid, 'file');
}
}