Posted by petermilad on March 2, 2010 at 2:14pm
8 followers
Jump to:
| Project: | Public Download Count |
| Version: | 7.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Issue Summary
The problem is that the report page displays nothing except "No download count records are found for the file."
I did changed the file system to public and downloaded some attached files and yet I get nothing but desperate. Is there any solution?
Comments
#1
Same here, my files are with the correct link eg. name_file(0), and I downloaded and still displaying "No download count records are found for the file."
#2
Well, I find this issue important to me a little bit
#3
When you move the mouse cursor over the file download link, what kind of URL do you see?
It's supposed to have pubdlcnt.php?file=xxxxxxxx&nid=zzzzz. Please let me know the URL.
In addition, make sure that you install PDC module to the standard 3rd party module directory where (drupal-root)/sites/all/modules. If not, PDC module may not work.
#4
Public download counter doesn't work for me too:-(
When I move the mouse cursor over the file download link, I see this URL.
http://MYSERVER/Drupal/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http...
Clean url and Public download are enabled, but counting is not working. Where could be problem?
I use drupal 6.19.
#5
I have the same problem after upgrading to CCK 6.x-2.9.
#6
> @vrato,
The link URL looks good.
When you click the download link, the file is downloaded but the counter is not implemented. Is that correct?
If so, the possible reasons of not counting are:
1) The file extension is not in the list of supported extensions. In case of your example link, .pdf is the file's extension. Be sure that this file extension is in the list of supported extensions.
2) Somehow, the URL of the target download file can not be verified. When the file is about to be downloaded, PDC module checks if the file URL is valid and the file actually exists or not. If it is determined to not to exists, then it skips updating counter. When the web server does not return expected responses (HTTP/1.1 200 OK or HTTP/1/1 302 Found) when the existence of the file is checked, the PDC module determines that the file does not exist and skip updating the counter. If this is the case, you can skip this existence check by making a minor code change (see below).
Before (pubdlcnt.php)
/**
* Function to check if the specified file URL is valid or not
*/
function is_valid_file_url($url) {
// replace space characters in the URL with '%20' to support file name
// with space characters
$url = preg_replace('/\s/', '%20', $url);
if (!valid_url($url, true)) {
return false;
}
// -- skipped --
if (!url_exists($url)) {
return false;
}
return true; // it seems that the file URL is valid
}
After (pubdlcnt.php)
/**
* Function to check if the specified file URL is valid or not
*/
function is_valid_file_url($url) {
// replace space characters in the URL with '%20' to support file name
// with space characters
$url = preg_replace('/\s/', '%20', $url);
if (!valid_url($url, true)) {
return false;
}
// -- skipped --
/* -- comment out three lines below
if (!url_exists($url)) {
return false;
}
*/
return true; // it seems that the file URL is valid
}
Please make this change and see if this fix your issue or not.
Thanks,
#7
I have the same issue (in 7.x-dev).
The problem is that I have my module installed in the (now standard) contrib/ directory, so my file structure is:
/path/to/drupal/sites/all/modules/contrib/pubdlcnt
If I adjust the code in pubdlcnt.php to the following, the report displays correctly:
// we need to change the current directory to the (drupal-root) directory
// in order to include some necessary files.
if (file_exists('../../../../includes/bootstrap.inc')) {
// If this script is in the (drupal-root)/sites/(site)/modules/pubdlcnt directory
chdir('../../../../'); // go to drupal root
}
else if (file_exists('../../../../../includes/bootstrap.inc')) {
// If this script is in the (drupal-root)/sites/(site)/modules/contrib/pubdlcnt directory
chdir('../../../../../'); // go to drupal root
}
else if (file_exists('../../includes/bootstrap.inc')) {
// If this script is in the (drupal-root)/modules/pubdlcnt directory
chdir('../../'); // go to drupal root
}
else {
// Non standard location: you need to edit the line below so that chdir()
// command change the directory to the drupal root directory of your server
// using an absolute path.
// First, please delete the line below and then edit the next line
print "Error: Public Download Count module failed to work. The file pubdlcnt.php requires manual editing.\n";
chdir('/absolute-path-to-drupal-root/'); // <---- edit this line!
if (!file_exists('./includes/bootstrap.inc')) {
// We can not locate the bootstrap.inc file, let's give up using the
// script and just fetch the file
header('Location: ' . $_GET['file']);
exit;
}
}
#8
#6
That works in 7.x-1.0
#9
The contrib issue in #7 is addressed in #1294868: Also check if module is in sites/all/modules/contib/pubdlcnt. That doesn't seem to be the main problem in this issue. #8 suggests the main problem is fixed with #6, so marking this RTBC.