Hi, thanks for committing the dev version.
I get these errors when clicking a pdf to download (private file).
Warning: Missing argument 4 for download_count_file_download_access_alter(), called in /includes/module.inc on line 1003 and defined in download_count_file_download_access_alter() (line 124 of modules/download_count/download_count.module).
Notice: Undefined variable: entity in download_count_file_download_access_alter() (line 152 of modules/download_count/download_count.module).
Notice: Trying to get property of non-object in download_count_file_download_access_alter() (line 152 of modules/download_count/download_count.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'id' cannot be null: INSERT INTO {download_count} (fid, uid, type, id, ip_address, referrer, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => 301 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => 127.0.0.1 [:db_insert_placeholder_5] => /s950-3u-compactpci-radiation-tolerant-powerpc%C2%AE-sbc [:db_insert_placeholder_6] => 1321544325 ) in download_count_file_download_access_alter() (line 157 of modules/download_count/download_count.module).
Comments
Comment #1
WorldFallz commentedbah... I totally forgot to mention on the project page that the d7 version requires the patch from #1143460: hook_file_download_access_alter missing entity argument. Now that the bulk of the d7 conversion is done, I'll try to push forward that patch but if anyone wants to review/take a look at it, the more eyes the better.
Comment #2
TripleEmcoder commentedPatches on that page seem to say that they are for Drupal 8, so what about the d7 version of this module? Which patch should be applied?
Comment #3
WorldFallz commentedPatches for core must always be submitted on the current dev branch and then backported which is why I had to roll the patch for d8. It might still apply to d7, but if not the changes are tiny and can be manually applied until I get a chance to roll a d7 version. Since the 2nd patch caused all sorts of test failures, I recommend using the first one.
Comment #4
alioso commentedI had it working on D7 (first version). Fixed the problem. Thanks
Comment #5
Anonymous (not verified) commentedTried patching but PDOException still exists.
Outputting $file in function download_count_file_download_access_alter seems to print file fields attributes, not actual file objects.
Edit: output of $file below
Comment #6
WorldFallz commentedjust an fyi-- i'm maintaining the required core patch in #1484206: use this required core patch until the core bug fix is committed.
Comment #7
WorldFallz commentedwhich fixes this problem (people are trying to use the d8 patch for d7).