function drush_advagg_clear_all_files in Advanced CSS/JS Aggregation 8.3
Same name and namespace in other branches
- 8.4 advagg.drush.inc \drush_advagg_clear_all_files()
- 8.2 advagg.drush.inc \drush_advagg_clear_all_files()
- 7.2 advagg.drush.inc \drush_advagg_clear_all_files()
Callback function for drush advagg-clear-all-files.
Related topics
1 call to drush_advagg_clear_all_files()
- drush_advagg_force_new_aggregates in ./
advagg.drush.inc - Callback function for drush advagg-force-new-aggregates.
File
- ./
advagg.drush.inc, line 131 - Drush commands for Advanced CSS/JS Aggregation.
Code
function drush_advagg_clear_all_files() {
// Clear out the cache.
Cache::invalidateTags([
'library_info',
]);
\Drupal::cache('advagg')
->invalidateAll();
$pub = \Drupal::service('file_system')
->realpath('public://');
$css_count = count(glob($pub . '/css/optimized/*.css'));
$js_count = count(glob($pub . '/js/optimized/*.js'));
foreach ([
'public://js/optimized',
'public://css/optimized',
] as $path) {
if (file_exists($path)) {
file_unmanaged_delete_recursive($path);
}
}
// Report back the results.
drush_log(dt('All AdvAgg optimized files have been deleted. %css_count CSS files and %js_count JS files have been removed.', [
'%css_count' => $css_count,
'%js_count' => $js_count,
]));
}