You are here

function eu_cookie_compliance_clear_caches in EU Cookie Compliance (GDPR Compliance) 7

Same name and namespace in other branches
  1. 7.2 eu_cookie_compliance.module \eu_cookie_compliance_clear_caches()

Clear cache for the eu_cookie_compliance settings.

6 calls to eu_cookie_compliance_clear_caches()
eu_cookie_compliance_admin_category_delete_form_submit in ./eu_cookie_compliance.admin.categories.inc
Submit handler for deleting an existing cookie category.
eu_cookie_compliance_admin_category_form_submit in ./eu_cookie_compliance.admin.categories.inc
Submit handler for adding / editing a cookie consent category.
eu_cookie_compliance_admin_form_validate in ./eu_cookie_compliance.admin.inc
Validates form for cookie control banner.
eu_cookie_compliance_update_7003 in ./eu_cookie_compliance.install
Clear cache for only the settings of this module, to initialize new module settings.
eu_cookie_compliance_update_7004 in ./eu_cookie_compliance.install
Version 1.21. Clear cache for only the settings of this module.

... See full list

File

./eu_cookie_compliance.module, line 718
EU cookie compliance primary module file.

Code

function eu_cookie_compliance_clear_caches() {
  $use_domain = FALSE;
  if (module_exists('domain')) {
    $domains = domain_domains();
    $use_domain = TRUE;
  }

  // Clear cache for all enabled themes.
  $themes = system_rebuild_theme_data();
  foreach ($themes as $theme) {
    if ($theme->status == 1) {
      if (module_exists('locale')) {
        $languages = locale_language_list();
      }
      else {
        global $language;
        $current_language = !empty($language->language) ? $language->language : 'en';
        $languages = array(
          $current_language => $current_language,
        );
      }
      foreach ($languages as $key => $current_language) {
        if ($use_domain) {
          foreach ($domains as $domain) {
            cache_clear_all('eu_cookie_compliance_client_settings:' . $key . ':' . $theme->name . ':' . $domain['domain_id'], 'cache', TRUE);
          }
        }
        else {
          cache_clear_all('eu_cookie_compliance_client_settings:' . $key . ':' . $theme->name, 'cache', TRUE);
        }
      }
    }
  }
}