You are here

function drush_advagg_clear_all_files in Advanced CSS/JS Aggregation 8.2

Same name and namespace in other branches
  1. 8.4 advagg.drush.inc \drush_advagg_clear_all_files()
  2. 8.3 advagg.drush.inc \drush_advagg_clear_all_files()
  3. 7.2 advagg.drush.inc \drush_advagg_clear_all_files()

Callback function for drush advagg-clear-all-files.

Callback is called by using drush_hook_command() where hook is the name of the module (advagg) and command is the name of the Drush command with all "-" characters converted to "_" characters.

File

./advagg.drush.inc, line 96
Drush commands for Advanced CSS/JS Aggregation.

Code

function drush_advagg_clear_all_files() {

  // Run the command.
  $css_files = \Drupal::service('asset.css.collection_optimizer')
    ->deleteAllReal();
  $js_files = \Drupal::service('asset.js.collection_optimizer')
    ->deleteAllReal();

  // Report back the results.
  drush_log(dt('All AdvAgg files have been deleted. @css_count CSS files and @js_count JS files have been removed.', [
    '@css_count' => count($css_files),
    '@js_count' => count($js_files),
  ]), 'ok');
}