You are here

public function JavascriptLocalCache::clearGoogleAnalyticsJsCache in Google Analytics 4.x

Delete cached files and directory.

File

src/JavascriptLocalCache.php, line 126

Class

JavascriptLocalCache

Namespace

Drupal\google_analytics

Code

public function clearGoogleAnalyticsJsCache() {
  $path = 'public://google_analytics';
  if (is_dir($path)) {
    $this->fileSystem
      ->deleteRecursive($path);

    // Change query-strings on css/js files to enforce reload for all users.
    _drupal_flush_css_js();
    $this->logger
      ->info('Local Google Analytics file cache has been purged.');
  }
}