Index: flexiaccess.admin.inc IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- flexiaccess.admin.inc (date 1531485384000) +++ flexiaccess.admin.inc (date 1531775944000) @@ -86,7 +86,6 @@ } drupal_set_message(t('Flexi access changes have been updated.')); - cache_clear_all(); } Index: flexiaccess.module IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- flexiaccess.module (date 1531485384000) +++ flexiaccess.module (date 1531775944000) @@ -324,3 +324,30 @@ } drupal_set_message("Deleted $num ACLs"); } + + +/** + * Forcibly clear the page cache for the given node + * + * The cache_page table contains separate records for the aliased and unaliased paths of a node. + * This removes both. + * + * @param $node \Drupal\node\Entity\Node + * The node for which to clear the page cache. + * + * @return int + * The number of records deleted from the cache_page table. + */ +function flexiaccess_force_clear_page_cache_for_node($node) { + + $path = 'node/' . $node->nid; + $url = url($path); + + $or = db_or(); + $or->condition('cid', "%$path%", 'LIKE'); + $or->condition('cid', "%$url%", 'LIKE'); + $query = db_delete('cache_page')->condition($or); + $result = $query->execute(); + return $result; + +} Index: flexiaccess.nodes.inc IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- flexiaccess.nodes.inc (date 1531485384000) +++ flexiaccess.nodes.inc (date 1531775944000) @@ -55,7 +55,7 @@ $acl_id = acl_get_id_by_name('flexiaccess', $op . '_' . $node->nid); $foo = acl_edit_form($form_state, $acl_id, t('Manage !op permission', array('!op' => $op))); - + $form['acl'][$op] = acl_edit_form($form_state, $acl_id, t('!op permission', array('!op' => $op))); $form['acl'][$op]['#collapsed'] = !isset($_POST['acl_' . $acl_id]) && !unserialize($form['acl'][$op]['user_list']['#default_value']); } @@ -94,13 +94,13 @@ foreach (array('view', 'update', 'delete') as $op) { if (isset($form_state['values']['acl'][$op])) { acl_save_form($form_state['values']['acl'][$op]); - } + } } } // Apply new settings. node_access_acquire_grants($node); - cache_clear_all(); + flexiaccess_force_clear_page_cache_for_node($node); drupal_set_message(t('Your changes to the ACL has been saved.')); } @@ -116,7 +116,7 @@ // Apply new settings. node_access_acquire_grants($node, TRUE); - cache_clear_all(); + flexiaccess_force_clear_page_cache_for_node($node); drupal_set_message(t('An ACL for the node has been created.')); } @@ -132,7 +132,7 @@ // Apply new settings. node_access_acquire_grants($node, TRUE); - cache_clear_all(); + flexiaccess_force_clear_page_cache_for_node($node); drupal_set_message(t('The ACLs list for the node has been removed.')); } Index: flexiaccess.users.inc IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- flexiaccess.users.inc (date 1531485384000) +++ flexiaccess.users.inc (date 1531775944000) @@ -209,10 +209,11 @@ } // Apply changes for the node. - node_access_acquire_grants(node_load($ac['nid'])); + $node = node_load($ac['nid']); + node_access_acquire_grants($node); + flexiaccess_force_clear_page_cache_for_node($node); } - cache_clear_all(); drupal_set_message(t('Your changes to the ACL has been saved.')); }