I work with Drupal 5 and Download Counter 5.x-1.0 module.

I have a content-type called Document which allows to attach a file. In my example (issue.PNG) I have the file BI.doc

I changed a part of download_count.module (code given here : http://drupal.org/node/110125#comment-199181)

<?php
function download_count_file_download($filename) {

  $file = file_create_path($filename);
  $result = db_query("SELECT f.* FROM {files} f WHERE filepath = '%s'", $file);
  if ($file = db_fetch_object($result)) {
    if (user_access('view uploaded files') && node_access('view', node_load($file->nid))) {
      $message = t('%file was downloaded', array('%file' => theme('placeholder', $filename)));
      watchdog('download', $message, WATCHDOG_NOTICE);       
      // If the file is already added, just increment the count,
      // otherwise add the file with count 1
      if(db_result(db_query("SELECT filename FROM {file_downloads} WHERE filename = '$filename'"))) {
        db_query("UPDATE {file_downloads} SET count = count+1 WHERE filename = '$filename'");
      }
      else {
        db_query("INSERT INTO {file_downloads} (filename, count) VALUES ('$filename', 1)");
      }           
    }
    else {
      $message = t('Failed to download %file', array('%file' => theme('placeholder', $filename)));    
      watchdog('download', $message, WATCHDOG_WARNING);
    }   
  }
}
?>

Now when I download one file counter's incrementation is one.
But the counter takes two wrong files images/PhotoBB 116.thumbnail.jpg and images/PC282766.thumbnail.JPG instead of BI.doc. Moreover the value for last update is 38 years 32 weeks ago.

Anybody to help me to solve this problem please ?

Regards,

Nicolas

CommentFileSizeAuthor
issue.PNG34.27 KBNicolas_85

Comments

iva2k’s picture

Project: Download Counter » Download Count
Version: master » 5.x-1.x-dev
Assigned: Nicolas_85 » Unassigned

I noticed this issue is in the wrong queue. Also, do not assign it to yourself unless you plan to fix it. Probably too old for anyone to care though.

WorldFallz’s picture

Status: Active » Closed (won't fix)

closing due to new maintainer and an unsupported version. A new 6.x-2.x version is forthcoming, please open new against that version when available.