? 6-validate.patch ? 6-x-conf-ignore.patch ? 683400-redirect.patch ? 710712-domain-DRUPAL-6--2.patch ? 752570-reset-3.patch ? 752570-reset-domain-nid.patch Index: domain.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.module,v retrieving revision 1.134.2.13 diff -u -p -r1.134.2.13 domain.module --- domain.module 18 Mar 2010 15:05:56 -0000 1.134.2.13 +++ domain.module 29 Mar 2010 17:12:58 -0000 @@ -1254,15 +1254,29 @@ function domain_get_path_match($path) { * * @param $nid * The node id. + * @param $reset + * A boolean flag indicating the need to reset the static variable for the node. + * @param $return + * Used with reset. Indicates that a new lookup should be run and the result returned. + * @see _domain_store_grants() * @return * An array, consisting of two parts. 'domain_id' is an array of active domain ids. 'domain_site' * is a TRUE/FALSE boolean indicating affiliate status. */ -function domain_get_node_domains($nid) { +function domain_get_node_domains($nid, $reset = FALSE, $return = FALSE) { static $lookup = array(); if (isset($lookup[$nid])) { - return $lookup[$nid]; + // If set and valid, return. + if (empty($reset)) { + return $lookup[$nid]; + } + // If reset and no return needed, unset and return. + else if (empty($return)) { + unset($lookup[$nid]); + return; + } } + // Set the proper value for the node. $domains = array('domain_id' => array(), 'domain_site' => FALSE); $result = db_query("SELECT gid, realm FROM {domain_access} WHERE nid = %d AND (realm = '%s' OR realm = '%s')", $nid, 'domain_id', 'domain_site'); while ($data = db_fetch_object($result)) { @@ -1469,12 +1483,17 @@ function domain_node_access_records($nod * The grants passed by hook_node_access_records(). */ function _domain_store_grants($nid, $grants = array()) { + // Store the grants records. if ($nid > 0 && !empty($grants)) { db_query("DELETE FROM {domain_access} WHERE nid = %d", $nid); foreach ($grants as $grant) { db_query("INSERT INTO {domain_access} (nid, gid, realm) VALUES (%d, %d, '%s')", $nid, $grant['gid'], $grant['realm']); } } + + // Reset the static lookup for this node. + domain_get_node_domains($nid, TRUE); + // Ensure that our default grant is present. domain_set_default_grant(); }