You are here

function google_analytics_clear_js_cache in Google Analytics 8.3

Same name and namespace in other branches
  1. 8.2 google_analytics.module \google_analytics_clear_js_cache()

Delete cached files and directory.

2 calls to google_analytics_clear_js_cache()
GoogleAnalyticsAdminSettingsForm::validateForm in src/Form/GoogleAnalyticsAdminSettingsForm.php
Form validation handler.
google_analytics_uninstall in ./google_analytics.install
Implements hook_uninstall().

File

./google_analytics.module, line 580
Drupal Module: Google Analytics.

Code

function google_analytics_clear_js_cache() {
  $path = 'public://google_analytics';
  if (is_dir($path)) {
    \Drupal::service('file_system')
      ->deleteRecursive($path);

    // Change query-strings on css/js files to enforce reload for all users.
    _drupal_flush_css_js();
    \Drupal::logger('google_analytics')
      ->info('Local cache has been purged.');
  }
}