| Project: | Private Upload |
| Version: | 6.x-1.0-rc2 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
function _private_upload_migrate_private()
reports following problem...
user warning: Unknown column 'f.nid' in 'where clause' query: SELECT f.* FROM files f, node_access na WHERE f.nid = na.nid AND na.gid != 0 AND f.filepath NOT REGEXP "^uploads/private" GROUP BY f.fid in /users/home/progfrog/domains/photoremake.com/web/public/sites/all/modules/private_upload/private_upload.module on line 586.
... on the admin/user page.
The private upload configuration page at admin/settings/private_upload
reported: "There are 3 public files attached to private nodes. Click here to make them all private."
I clicked on the link, but the migration never went through. Instead the above error turned up.
I am not familiar with the code, but apparently there is no nid field in the file table; nid field that is used in the where clause.
Comments
#1
Probably the same problem for me, though somewhat different behaviour
I went to enabling Private Upload after installing this module for the first time while upgrading to D6.6
The process went successfully
I was happy seing several green notices and reading the following:
"There are 98 public files attached to private nodes. Click here to make them all private."
I clicked but only got a white page (no warning at this time). Nothing changed on the server, the files/private directory contains only 2 iles ".htaccess" and "privacy_test.txt"
Going back to the admin/settings/private_upload page, I got this warning:
"user warning: Unknown column 'f.nid' in 'where clause' query: SELECT f.* FROM files f, node_access na WHERE f.nid = na.nid AND na.gid != 0 AND f.filepath NOT REGEXP "^sites/default/files/private" GROUP BY f.fid in /home/psynapse/public_html/controlchaingroup/sites/all/modules/private_upload-6.x-1.0-rc2/private_upload/private_upload.module on line 586."
Refreshing the page makes the warning wanished
Hope this helps
#2
around line 585, in the function called _private_upload_migrate_private, change this
$result = db_query('SELECT f.* FROM {files} f, {node_access} na '.' WHERE f.nid = na.nid AND na.gid != 0 AND f.filepath NOT REGEXP "^%s" '.
' GROUP BY f.fid', $private_path );
to this
$result = db_query('SELECT f.* FROM {files} f inner join {upload} u on f.fid = u.fid INNER JOIN {node_access} na ON u.nid = na.nid '.' WHERE na.gid != 0 AND f.filepath NOT REGEXP "^%s" '.
' GROUP BY f.fid', $private_path );
#3
** EEP: don't apply this patch - I haven't tested it fully - see my next post instead please! **
Attached is a patch which should hopefully fix this issue (see http://drupal.org/patch/apply to find out how to apply this patch to an existing install, if you want to try it, but I wouldn't recommend using this on a live system! ;o).
/al
#4
I applied the patch and run the migration and got this error:
After removing the unexpected ')', I got the following message:
#5
Any update on this. I'm also getting a white screen when trying to migrate the public files attached to private nodes.
#6
Me too actually, anyone with a clue?
#7
I abandoned Drupal core file handling for File Framework.
This module offers total privacy and extensive flexibility in file management.