I just installed disknode. I was so excited as I need a download counter/tracker. However, something is wrong. Everything seems like it will work but when I click on the item to download, I get this error:

user error: Duplicate entry '0' for key 1
query: INSERT INTO downloads (fid, counter) VALUES (0, 1) in /home/idcmi/idcminnovations.net/html/includes/database.mysql.inc on line 66.
warning: Cannot modify header information - headers already sent by (output started at /home/idcmi/idcminnovations.net/html/includes/common.inc:384) in /home/idcmi/idcminnovations.net/html/modules/disknode/disknode.module on line 127.

Have you seen this before? Can it be fixed?

pls advise asap
idcm

Comments

elmuerte’s picture

Assigned: Unassigned » elmuerte

What is the download url?

It should be something like:

disknode/get/[number]/[filename]?download

if it's not then something is wrong.

idcm’s picture

the url of the disknode is http://idcminnovations.net/?q=node/59

when I click on the download link, I get
http://idcminnovations.net/?q=disknode/get/9/contentstructures.doc&download

so ... what does this mean?

idcm’s picture

One more thing. I just tried reinstalling - basically starting over. The first time I clicked on the download, I got a page that shows all the files in "files". I clicked back and tried again and got the error in question. Does this help?

elmuerte’s picture

Hmm... I hate it when I can't reproduce errors. Even that link you posted works when I try it.
Could be a caching issue.
Anyway, I added a safe guard in case a download can't be found (e.g. a download with ID 0 never exists) so it won't expose any details. An updated download should be available within 24 hours.
As for the rest this error remains an mystery to me.

idcm’s picture

i just cleared my cache and cookies. I see the counter working as the number has increased to 6. however, i still get the error. any suggestions as to what else i should clear?

thanks for your help. i will watch for the update and install that one.

idcm

idcm’s picture

okay, this is not going to make your day. I just switched to my laptop to see if it was a local thing and I got the same error. I hope the update you are doing will resolve.

btw, since you are viewing my content from my server space and are not getting the error, mayber there is something on your computer that I don't have. like ... what version browser do you use?

idcm

idcm’s picture

I found out something more. It only happens when my user name is logged in. when another user is logged in, it is fine. when i am logged out, it is fine.

so .... does this send a clue?

idcm

elmuerte’s picture

Try to clear the drupal cache (should be done automatically when you edit the menu or save the global settings).

If that helps then I only have to figure out why it was cached in the first place and how I prevent it.

idcm’s picture

okay, don't roll your eyes. if you can't tell, hubby and I are sw testers and can't leave anything alone ;-)

I had another acct add a disknode. I could get that one while logged in. I added another disknode, and can get all disknodes now.

must have had something to do with one or more of the following: all my permissions, the fact that i created the disknode, and/or that it was the first one.

take care
idcm

idcm’s picture

hhhmmm, that might have something to do with it. I added permissions to hubby's userid, maybe that did the refresh needed? Anyway, went ahead and saved global settings.

sounds like you have several options for improvement. BUT I must say that I am very excited about this option. my client needs it as a contract requirement and it will save the day if we can make sure it is working.

look forward to updates
idcm

elmuerte’s picture

well since you're sw testers... can you come up with a reproduction case?

idcm’s picture

Not without starting with a clean install as the problem seems to have resolved itself. We did too many changes at the same time to get it to work and thus don't have a process we can reuse.

BUT, if memory serves:

1. admin activates disk node module
2. admin creates disk node with attachment
3. while logged in as admin, click on the download link created as a result of the disk node
4. ?get error?
5. log out and try - ?be successful?

After this, I created a new account and that user could download it. I tried again and suddenly I could download while logged as admin.

sorry. but that is all I can remember. hope it helps
idcm

elmuerte’s picture

I can't reproduce it. Started with a clean drupal installation installed disknode and everything worked. Must be something specific to your installation.

idcm’s picture

I just installed another drupal (other site) and did the following (long-story short, got the errors but was able to resolve). See process below.

1. enabled disknode
2. looked at settings and it appeared to be okay - showed resources dir in field
3. clicked create content / disknode
4. clicked browse
5. realized content wasn't there
6. went to system ftp view and found resources dir wasn't in files dir so added it.
7. set permissions to write
8. uploaded a file into resources dir
9. went back to settings and save config again. - went okay
10. clicked create content/disknode
11. browsed to ppt file that I uploaded to files/resources via ftp
12. typed test text in fields
13. submitted
14. clicked download link that showed after submit
15. got this error:
Forbidden
You don't have permission to access /files/ on this server.
--------------------------------------------------------------------------------
Apache/2.0.51 (Fedora) Server at senerlearning.net Port 80

16. clicked back to make sure access was set to disknode in drupal - everything seems fine
17. system permissions for files dir set to drwxr-xrwx - so this should be okay. Will try again.
18. back in drupal, clicked admin/content
19. clicked the link to the test disknode
20. clicked the download link and got:
user error: Duplicate entry '0' for key 1
query: INSERT INTO downloads (fid, counter) VALUES (0, 1) in /home/jsener/senerlearning.net/html/includes/database.mysql.inc on line 66.
warning: Cannot modify header information - headers already sent by (output started at /home/jsener/senerlearning.net/html/includes/common.inc:384) in /home/jsener/senerlearning.net/html/modules/disknode/disknode.module on line 127.
21. clicked back to drupal
22. clicked create content / disknode - created second node and linked to same file as before
23. clicked download and got:
user error: Duplicate entry '0' for key 1
query: INSERT INTO downloads (fid, counter) VALUES (0, 1) in /home/jsener/senerlearning.net/html/includes/database.mysql.inc on line 66.
warning: Cannot modify header information - headers already sent by (output started at /home/jsener/senerlearning.net/html/includes/common.inc:384) in /home/jsener/senerlearning.net/html/modules/disknode/disknode.module on line 127.
24. clicked back
25. logged out
26. clicked first upload test - it worked
27. clicked second test - it worked
28. logged back in
29. clicked admin / content / first disknode link
30. clicked download
31. got this error - again
user error: Duplicate entry '0' for key 1
query: INSERT INTO downloads (fid, counter) VALUES (0, 1) in /home/jsener/senerlearning.net/html/includes/database.mysql.inc on line 66.
warning: Cannot modify header information - headers already sent by (output started at /home/jsener/senerlearning.net/html/includes/common.inc:384) in /home/jsener/senerlearning.net/html/modules/disknode/disknode.module on line 127.
32. clicked back
33. clicked settings / disknode / save config
34. clicked admin / content / first disknode
35. clicked download
36. same error
37. clicked back
38. clicked admin / access control
39. did not change anything but clicked save config
40. tried again - YEA! that did it.

elmuerte’s picture

It really sounds like a menu cache issue. Please double check if the disknode.module files contains the following line:
// $Id: disknode.module,v 1.3.2.4 2006/02/22 21:12:30 elmuerte Exp $

(or newer)
I changes the module a little while ago to report a "not found" error, so the SQL error you get shouldn't even be visible anymore (that change doesn't really solve this issue, but makes the error at least less harmful)

idcm’s picture

It shows

// $Id: disknode.module,v 1.3.2.1 2006/02/12 16:41:03 elmuerte Exp $

I downloaded the "most recent" - how do I get the version you are referencing?

idcm

elmuerte’s picture

Yep, old version.
You can get the latest releases here: http://drupal.org/node/43600/release

The drupal site is currently partially broken, the release dates of the releases are not updated properly (yet).

idcm’s picture

thanks!

elmuerte’s picture

Status: Active » Fixed

I'm going to assume this issue has been resolved in one of the last updates so i'm closing it.

Anonymous’s picture

Status: Fixed » Closed (fixed)