Closed (fixed)
Project:
Project
Version:
5.x-1.x-dev
Component:
Comments
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
22 Jul 2006 at 03:42 UTC
Updated:
21 Oct 2007 at 07:12 UTC
Jump to comment: Most recent file
when you delete a project node, we attempt to delete all traces of the project: the node, releases, subscriptions, issues, etc. unfortunately, we delete the wrong thing to try to delete all the comments. :(
currently, we just do this:
db_query('DELETE FROM {project_comments} WHERE nid = %d', $node->nid);
sadly, the nid in the {project_comments} table is the nid of the issue the comment belongs to, not the project. in fact, {project_comments} has no reference to the project nid at all.
so, we need to use a subselect (or equivalent), and delete these first, *before* deleting from {project_issues}.
perhaps this is best cleaned up by the move to using real comments for issues... (http://drupal.org/node/18920).
this also means that project_update_3() is wrong. :(
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | project_comments_delete47_2.patch | 1.9 KB | hunmonk |
| #9 | project_comments_delete47_1.patch | 1.32 KB | hunmonk |
| #8 | project_comments_delete_1.patch | 1.78 KB | hunmonk |
| #5 | project_comments_delete47_0.patch | 1.17 KB | hunmonk |
| #4 | project_comments_delete_0.patch | 1.17 KB | hunmonk |
Comments
Comment #1
hunmonk commentedtested on HEAD, and works perfectly
Comment #2
hunmonk commented...and the patch
Comment #3
hunmonk commentedpatch for 4.7 -- untested.
Comment #4
hunmonk commentedbah. subselects won't work in 4.7 and 5 :(
attached is for HEAD, tested and working.
Comment #5
hunmonk commentedfor 4.7, untested
Comment #6
dwwWow, all kinds of bugs related to this code. ;) The {project*} tables are in fact getting cleaned out, but we never actually delete the issue nodes themselves. :( So, you end up with a weird skeleton of the issue nodes for that project. Technically, the patch fixes the specific problem of the comments being left behind, but we should probably fix really deleting the issues, too, while we're at it.
Comment #7
hunmonk commentedi think the best approach might be to:
sound like a plan?
Comment #8
hunmonk commentedok, let's try this again...
patch for HEAD
Comment #9
hunmonk commented... and 4.7
Comment #10
dwwtested #9 on a 4.7.x-2.* site, works like a charm. code looks good.
the one lingering problem is that we don't delete the files in the filesystem that are attached to the comments we're deleting. :(
Comment #11
hunmonk commentedattached should handle file deletions for comments as well. untested. also, this patch should apply to 5.x-1.x, and should probably be tested there as well.
Comment #12
dwwexcellent. tested #11 on 4.7.x-2.* and 5.x-1.* -- works like a charm. code is good. #8 is still good for HEAD, since comment_upload() is cleaning up the files for us in that case. RTBC!
Comment #13
hunmonk commentedfixed in 4.7.x-1.x, 4.7.x-2.*, 5.x-1.*, HEAD. phew!
Comment #14
(not verified) commented