You are here

function googleanalytics_clear_js_cache in Google Analytics 7.2

Same name and namespace in other branches
  1. 6.4 googleanalytics.module \googleanalytics_clear_js_cache()
  2. 6.3 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
Implements _form_validate().
googleanalytics_disable in ./googleanalytics.install
Implements hook_disable().

File

./googleanalytics.module, line 577
Drupal Module: Google Analytics

Code

function googleanalytics_clear_js_cache() {
  $path = 'public://googleanalytics';
  if (file_prepare_directory($path)) {
    file_scan_directory($path, '/.*/', array(
      'callback' => 'file_unmanaged_delete',
    ));
    drupal_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);
  }
}