function matomo_clear_js_cache in Matomo Analytics 8
Same name and namespace in other branches
- 7.2 matomo.module \matomo_clear_js_cache()
Delete cached files and directory.
1 call to matomo_clear_js_cache()
- MatomoAdminSettingsForm::validateForm in src/
Form/ MatomoAdminSettingsForm.php - Form validation handler.
File
- ./
matomo.module, line 553 - Drupal Module: Matomo.
Code
function matomo_clear_js_cache() {
$path = 'public://matomo';
if (\Drupal::service('file_system')
->prepareDirectory($path)) {
\Drupal::service('file_system')
->scanDirectory($path, '/.*/', [
'callback' => '_matomo_file_delete',
]);
\Drupal::service('file_system')
->rmdir($path);
// Change query-strings on css/js files to enforce reload for all users.
_drupal_flush_css_js();
\Drupal::logger('matomo')
->info('Local cache has been purged.');
}
}