summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--acl.install12
-rw-r--r--acl.module11
3 files changed, 24 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 5f05932..1d622d3 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,7 @@ CHANGELOG for ACL for Drupal 6
acl HEAD:
Porting to D6:
+ - #231096: Implement hook_nodeapi('delete') and remove orphaned {acl_node} records.
- Improve acl_node_access_explain().
- Avoid generating E_NOTICEs.
- Make [Delete] button work.
diff --git a/acl.install b/acl.install
index afb5008..ac8ca25 100644
--- a/acl.install
+++ b/acl.install
@@ -82,6 +82,8 @@ function acl_schema() {
'not null' => TRUE,
'default' => 0)),
'primary key' => array('acl_id', 'nid'),
+ 'indexes' => array(
+ 'nid' => array('nid')),
);
return $schema;
}
@@ -110,3 +112,13 @@ function acl_update_2() {
db_add_primary_key($ret, 'acl_node', array('acl_id', 'nid'));
return $ret;
}
+
+/**
+ * Put back acl_node(nid) index for deleting nodes.
+ */
+function acl_update_4() {
+ $ret = array();
+ db_add_index($ret, 'acl_node', 'nid', array('nid'));
+ db_query("DELETE FROM {acl_node} WHERE nid NOT IN (SELECT nid FROM {node})");
+ return $ret;
+}
diff --git a/acl.module b/acl.module
index 798172e..15cb73e 100644
--- a/acl.module
+++ b/acl.module
@@ -247,6 +247,17 @@ function acl_node_grants($account, $op) {
}
/**
+ * Implementation of hook_nodeapi
+ */
+function acl_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
+ switch ($op) {
+ case 'delete':
+ db_query("DELETE FROM {acl_node} WHERE nid = %d", $node->nid);
+ break;
+ }
+}
+
+/**
* Implementation of hook_node_access_explain
*/
function acl_node_access_explain($row) {