implement hook_nodeapi, 'delete' op to clean up acl_node table
jpoesen - March 7, 2008 - 10:14
| Project: | ACL |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Analogous to content_access' implementation of hook_nodeapi where it cleans up {content_access}, ACL's implemenation could clean up {acl_node}.
illustration:
/*
* Implementation of hook_nodeapi()
*/
function content_access_nodeapi($node, $op, $teaser, $page) {
if ($op == 'delete') {
db_query("DELETE FROM {content_access} WHERE nid = %d", $node->nid);
}
}When an {acl_node} record is removed, we should check its acl_id to see if it was the only node attached to the ACL. If so, the {acl} record and any corresponding {acl_user} records should be removed as well to avoid orphaned records
Any specific reason this cleanup process is not yet in place?
thanks!
Joeri

#1
Good idea, thank you for the suggestion. Do you want to supply a patch?
#2
sure, but it'll probably have to wait at least a week or two if that's ok...
#3
I'm feeling a bit of pressure from the new release UI to make a new release soon, so I may go ahead and do it myself...
#4
Committed to 5.x-1.x-dev and HEAD.
I need this to fix a Forum Access D6 issue.
No, this is not correct. If you define moderators in Forum Access, these moderators exist independently of whether you have any nodes in that forum or not. Your module needs to take care of the acl_id's and uid's that it creates. If you want them deleted after the last node is gone, then you must hook_nodeapi() yourself.
#5
Automatically closed -- issue fixed for two weeks with no activity.