My site has a few attachments given the same name, but they're different files. The upload module looks after this very well, but this module freaks out with a count being incremented for any file with a matching name.

I've attached a patch that changes this module to store counts by the unique `fid` field from the uploads table.

It also shows the node title in the download counter page.

CommentFileSizeAuthor
download-count-by-fid.patch5.19 KBmattconnolly

Comments

Chill35’s picture

Status: Active » Needs work

Can you provide an update path for the table, ie: implement HOOK_update_1()?

Chill35’s picture

Status: Needs work » Closed (won't fix)

Actually this won't work for many people - including myself.

Often people want to update a file attachment, for example to correct something in it. The way to go about this is either to overwrite the existing file using FTP or remove the attachment -- effectively deleting the original file from the server - and then reattach the new file that has the same name. When updating a file like this, one may not want the counter to be reset to zero. If download_count is fid-based, rather than filename-based, any update/change to a file through the Drupal interface will cause the counter to be reset because a new fid will be generated for the file.