You are here

function oa_buttons_clear_section_button_cache in Open Atrium Core 7.2

Clear the button cache for the given group

Parameters

null $gid. If NULL, use current space context. If 0, clear all groups:

7 calls to oa_buttons_clear_section_button_cache()
oa_buttons_node_insert in modules/oa_buttons/oa_buttons.module
Implements hook_node_insert().
oa_buttons_node_update in modules/oa_buttons/oa_buttons.module
Implements hook_node_update().
oa_buttons_og_membership_delete in modules/oa_buttons/oa_buttons.module
Implements hook_og_membership_delete().
oa_buttons_og_membership_insert in modules/oa_buttons/oa_buttons.module
Implements hook_og_membership_insert().
oa_buttons_og_membership_update in modules/oa_buttons/oa_buttons.module
Implements hook_og_membership_update().

... See full list

File

modules/oa_buttons/oa_buttons.module, line 334

Code

function oa_buttons_clear_section_button_cache($gid = NULL) {
  if (!isset($gid)) {
    $gid = oa_core_get_space_context();
  }
  $cache_name = 'oa_section_buttons:';
  $bin = 'cache_oa_section_buttons';
  if (!empty($gid)) {
    $cache_key = $cache_name . $gid;
    cache_clear_all($cache_key, $bin, TRUE);
    if (module_exists('og_subgroups')) {

      // Clear button cache for any associated subgroups as well.
      $subgroups = og_subgroups_children_load('node', $gid, TRUE, FALSE);
      if (!empty($subgroups['node'])) {
        foreach ($subgroups['node'] as $nid) {
          $cache_key = $cache_name . $nid;
          cache_clear_all($cache_key, $bin, TRUE);
        }
      }
    }
  }
  else {
    cache_clear_all($cache_name, $bin, TRUE);
  }
}