You are here

public function OperationsForm::clearStaleAggregates in Advanced CSS/JS Aggregation 8.3

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

Clear out all stale advagg aggregated files.

File

src/Form/OperationsForm.php, line 278

Class

OperationsForm
Configure advagg settings for this site.

Namespace

Drupal\advagg\Form

Code

public function clearStaleAggregates() {
  $counts = advagg_cron(TRUE);

  // Report back the results.
  if (!empty($counts['css']) || !empty($counts['js'])) {
    $this->messenger
      ->addMessage($this
      ->t('All stale aggregates have been deleted. %css_count CSS files and %js_count JS files have been removed.', [
      '%css_count' => count($counts['css']),
      '%js_count' => count($counts['js']),
    ]));
  }
  else {
    $this->messenger
      ->addMessage($this
      ->t('No stale aggregates found. Nothing was deleted.'));
  }
}