I create filenames using some ID and timestamps. I don't want to add additional table to "remember" associations, as filename keeps them pretty well:
$filename = get_symbol_by_id($id) . ' ' . get_modified_by_id($id) . '.xml';
Also, I don't care if they will be managed or not. And I don't care if they get deleted - I can recreate them on demand. They are small, so leaving older ones behind does not create any cost worth taking care of. What is the proper course of action?
"Unmanaged" files seems to be generally discouraged in 7, but using them is pretty straightforward with tools like:
file_unmanaged_save_data
file_exists($uri)
in a manner shown herefile_transfer
takes$uri
, not$fid
, so it's even easier to use it on unmanaged files
With managed files, I'm afraid I would be forced to use
EntityFieldQuery
, overly complicated for such simple task or$conditions
infile_load_multiple
, marked as deprecated.
So what's the proper course of action, if I want to avoid both deprecated functionality and overly complicated code?