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
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

salvis - March 8, 2008 - 12:26
Title:implement hook_nodeapi, 'view' op to clean up acl_node table» implement hook_nodeapi, 'delete' op to clean up acl_node table
Category:feature request» task

Good idea, thank you for the suggestion. Do you want to supply a patch?

#2

jpoesen - March 8, 2008 - 20:43

sure, but it'll probably have to wait at least a week or two if that's ok...

#3

salvis - March 8, 2008 - 20:52

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

salvis - March 10, 2008 - 04:30
Status:active» fixed

Committed to 5.x-1.x-dev and HEAD.

I need this to fix a Forum Access D6 issue.

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

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

Anonymous (not verified) - March 24, 2008 - 04:31
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.