You are here

public function OperationsForm::clearAggregates in Advanced CSS/JS Aggregation 8.2

Same name and namespace in other branches
  1. 8.4 src/Form/OperationsForm.php \Drupal\advagg\Form\OperationsForm::clearAggregates()
  2. 8.3 src/Form/OperationsForm.php \Drupal\advagg\Form\OperationsForm::clearAggregates()

Clear out all advagg cache bins and clear out all advagg aggregated files.

2 calls to OperationsForm::clearAggregates()
OperationsForm::clearAll in src/Form/OperationsForm.php
Clear ALL saved information and aggregates.
OperationsForm::incrementCounter in src/Form/OperationsForm.php
Clear out all advagg cache bins and increment the counter.

File

src/Form/OperationsForm.php, line 321

Class

OperationsForm
Configure advagg settings for this site.

Namespace

Drupal\advagg\Form

Code

public function clearAggregates() {

  // Clear out the cache.
  Cache::invalidateTags([
    'library_info',
    'advagg_css',
    'advagg_js',
  ]);
  $css_files = $this->cssCollectionOptimizer
    ->deleteAllReal();
  $js_files = $this->jsCollectionOptimizer
    ->deleteAllReal();

  // Report back the results.
  drupal_set_message($this
    ->t('All AdvAgg aggregates 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),
  ]));
}