public function LdapAuthorizationConsumerOG::flushRelatedCaches in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.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 370
Class
Code
public function flushRelatedCaches($consumers = NULL, $user = NULL) {
if ($user) {
$this
->usersAuthorizations($user, TRUE, FALSE);
// clear user authorizations cache
}
if ($this->ogVersion == 1) {
og_group_membership_invalidate_cache();
}
else {
og_membership_invalidate_cache();
}
if ($consumers) {
$gids_to_clear_cache = array();
foreach ($consumers as $i => $consumer_id) {
if ($this->ogVersion == 1) {
// og 7.x-1.x
list($gid, $rid) = $this
->og1ConsumerIdParts($consumer_id);
}
else {
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();
}
}