You are here

public function LdapAuthorizationConsumerOG::flushRelatedCaches in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php \LdapAuthorizationConsumerOG::flushRelatedCaches()

Attempt to flush related caches. This will be something like og_invalidate_cache($gids)

Parameters

$consumers: associative array in form of LdapAuthorizationConsumerAbstract::populateConsumersFromConsumerIds

Overrides LdapAuthorizationConsumerAbstract::flushRelatedCaches

1 call to LdapAuthorizationConsumerOG::flushRelatedCaches()
LdapAuthorizationConsumerOG::grantsAndRevokes in ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php

File

ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php, line 234

Class

LdapAuthorizationConsumerOG

Code

public function flushRelatedCaches($consumers = NULL, $user = NULL) {
  if ($user) {

    // Clear user authorizations cache.
    $this
      ->usersAuthorizations($user, TRUE, FALSE);
  }
  og_membership_invalidate_cache();
  if ($consumers) {
    $gids_to_clear_cache = [];
    foreach ($consumers as $i => $consumer_id) {
      list($entity_type, $gid, $rid) = $this
        ->og2ConsumerIdParts($consumer_id);
      $gids_to_clear_cache[$gid] = $gid;
    }
    og_invalidate_cache(array_keys($gids_to_clear_cache));
  }
  else {
    og_invalidate_cache();
  }
}