Respond to file deletion.
This hook is invoked after the file has been removed from the filesystem and after its records have been removed from the database.
Drupal\file\File $file: The file that has just been deleted.
Drupal\file\FileStorageController::delete()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_file_delete(Drupal\file\File $file) {
// Delete all information associated with the file.
db_delete('upload')
->condition('fid', $file->fid)
->execute();
}