You are here

function taxonomy_access_affected_nodes in Taxonomy Access Control 7

Caches and retrieves nodes affected by a taxonomy change.

Parameters

array $affected_nodes: (optional) If we are caching, the list of nids to cache. Defaults to NULL.

bool $reset: (optional) Flag to manually reset the list. Defaults to FALSE.

Return value

The cached list of nodes.

Related topics

4 calls to taxonomy_access_affected_nodes()
taxonomy_access_delete_default_grants in ./taxonomy_access.module
Deletes module configurations for the given vocabulary IDs.
taxonomy_access_delete_role_grants in ./taxonomy_access.module
Deletes module configurations for the given role IDs.
taxonomy_access_delete_term_grants in ./taxonomy_access.module
Deletes module configurations for the given term IDs.
taxonomy_access_shutdown in ./taxonomy_access.module
Shutdown function: Performs any needed node access updates.

File

./taxonomy_access.module, line 612
Allows administrators to specify access control for taxonomy categories.

Code

function taxonomy_access_affected_nodes(array $affected_nodes = NULL, $reset = FALSE) {
  static $nodes = array();

  // If node_access_needs_rebuild or $reset are set, reset list and return.
  if (!empty($nodes)) {
    if (node_access_needs_rebuild() || $reset) {
      $nodes = array();
      return;
    }
  }

  // If we were passed a list of nodes, cache.
  if (isset($affected_nodes)) {
    $nodes = array_unique(array_merge($nodes, $affected_nodes));

    // Stop caching if there are more nodes than the limit.
    if (sizeof($nodes) >= TAXONOMY_ACCESS_MAX_UPDATE) {
      _taxonomy_access_flag_rebuild();
      unset($nodes);
    }
  }
  else {
    return $nodes;
  }
}