You are here

function googleanalytics_clear_js_cache in Google Analytics 6.3

Same name and namespace in other branches
  1. 6.4 googleanalytics.module \googleanalytics_clear_js_cache()
  2. 7.2 googleanalytics.module \googleanalytics_clear_js_cache()
  3. 7 googleanalytics.module \googleanalytics_clear_js_cache()

Delete cached files and directory.

2 calls to googleanalytics_clear_js_cache()
googleanalytics_admin_settings_form_validate in ./googleanalytics.admin.inc
googleanalytics_disable in ./googleanalytics.install
Remove cache directory if module is disabled (or uninstalled).

File

./googleanalytics.module, line 428
Drupal Module: GoogleAnalytics Adds the required Javascript to the bottom of all your Drupal pages to allow tracking by the Google Analytics statistics package.

Code

function googleanalytics_clear_js_cache() {
  $path = file_create_path('googleanalytics');
  if (file_check_directory($path)) {
    file_scan_directory($path, '.*', array(
      '.',
      '..',
      'CVS',
    ), 'file_delete', TRUE);
    rmdir($path);

    // Change query-strings on css/js files to enforce reload for all users.
    _drupal_flush_css_js();
    watchdog('googleanalytics', 'Local cache has been purged.', array(), WATCHDOG_INFO);
  }
}