Closed (fixed)
Project:
Filefield Stats
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Aug 2011 at 23:24 UTC
Updated:
16 Dec 2011 at 11:50 UTC
Hi,
This modules records every file, but if it gets deleted, a report would be meaningless (for these deleted files that you don't know who they are anymore).
I suggest two solutions:
- Records file name also (meaningless if you don't have the file anymore)
- hook file_delete to erase the record for that fid.
I added this to filefield_stats.module (i don't know how to create a patch):
function filefield_stats_file_delete($file) {
drupal_set_message('object' . $file->fid);
db_query("DELETE FROM filefield_stats WHERE fid = %d", $file->fid);
}
Comments
Comment #1
fietserwinFor now, I added your suggestion to add a hook_file_delete:
Thus including angle brackets and without a message, that is up to filefield.
In a future release, I might add the name of the file in which case this feature should probably become optional. but that will introduce an admin settings form, etc.