You are here

function matomo_clear_js_cache in Matomo Analytics 7.2

Same name and namespace in other branches
  1. 8 matomo.module \matomo_clear_js_cache()

Delete cached files and directory.

2 calls to matomo_clear_js_cache()
matomo_admin_settings_form_validate in ./matomo.admin.inc
matomo_disable in ./matomo.install
Remove cache directory if module is disabled (or uninstalled).

File

./matomo.module, line 545
Drupal Module: Matomo

Code

function matomo_clear_js_cache() {
  $path = 'public://matomo';
  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('matomo', 'Local cache has been purged.', array(), WATCHDOG_INFO);
  }
}