This is nice module to have. Is it still maintained?

I encountered a couple of issues:

1). while settings say ignore 'jpg' files, the module still counts all 'JPG' files.

2). there is an incompatibility with iTweak Upload module.

I resolved these issues in the attached patch. Please review for committing to CVS.

Fixes are straightforward (issue 1 is a simple use of strtolower, issue 2 is splitting download stats code into _download_count_stats() function so it becomes available for iTweak Upload and other modules to call).

Comments

iva2k’s picture

StatusFileSize
new3.09 KB

One more issue worth addressing in bulk:
3). hook_file_download() may be used to only check for file access permissions. Download count increments the counter incorrectly for such calls.

Updated patch covering all 3 issues is included.

WorldFallz’s picture

Version: 6.x-1.x-dev »
WorldFallz’s picture

Status: Needs review » Active

strtolower fix committed-- thanks. Still trying to understand the other fix.

iva2k’s picture

I guess you meant fix 3) in #1...
Anyway, more explanations:

2) is straightforward - _download_count_stats() split does not change existing functionality. It just makes the download counter available to other modules in more universal way. It may be better with a new hook, but that may require some core improvements. See issue #588106: Duplicate listing of files when also using download_count.module.

3) is very specific to what itweak_upload is trying to do, but also applicable to other scenarios. ITU needs the info about the file without downloading it (checks file type). There is no API call to do it in drupal, only hook_file_download() which returns the needed information. The problem is that hook_file_download() assumes the file will be downloaded. My patch adds a second optional argument that tells it is just an info check. Otherwise download_count increments every time the page with the file is served and itweak_upload is used.

Hope that clarifies the purpose.

iva2k’s picture

Version: » 6.x-1.5
Status: Active » Needs review

I'd like to know if the remaining 2 fixes can be committed to 1.x-dev and also rolled over to 2.x-dev. Module interoperability is at stake.

WorldFallz’s picture

sorry I've slow with this module-- but yes, your patches look good. Interoperability is always a good thing. I'm just finishing up a filter for the views integration, then testing these will be next. Assuming no bugs i have no problem committing them.

Thanks for the patches!

WorldFallz’s picture

Status: Needs review » Needs work

somehow this didn't make it into 1.x-- just committed the strtolower and checkonly changes.

Sorry, but I'm not sure how the other change fixes compat with iTweak upload. I'm not trying to be difficult, but i'm not a professional developer and I need to understand any code changes I commit. Can you explain what the problem is?

WorldFallz’s picture

also committed the checkonly option to 6.x-2.x branch (already had the strtolower fix).

WorldFallz’s picture

Title: Patch for review - misc fixes. » compatability with iTweak Upload module
WorldFallz’s picture

Status: Needs work » Closed (works as designed)

no response in a almost a year, and d6/core upload module is a dead end. Reopen if you want to pursue the outstanding items.