Same name in other branches
  1. 5.0.x src/Form/OperationsForm.php \Drupal\advagg\Form\OperationsForm::clearAggregates()
  2. 8.x-2.x src/Form/OperationsForm.php \Drupal\advagg\Form\OperationsForm::clearAggregates()
  3. 8.x-3.x src/Form/OperationsForm.php \Drupal\advagg\Form\OperationsForm::clearAggregates()
  4. 8.x-4.x 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::incrementCounter dans src/Form/OperationsForm.php
Increment the global counter. Also full cache clear.
OperationsForm::toggleBypassCookie dans src/Form/OperationsForm.php
Set or remove the AdvAggDisabled cookie.

Fichier

src/Form/OperationsForm.php, line 183

Classe

OperationsForm
Configure advagg settings for this site.

Namespace

Drupal\advagg\Form

Code

public function clearAggregates() {
    // Clear out the cache.
    Cache::invalidateTags([
        'library_info',
    ]);
    $this->cache
        ->invalidateAll();
    $pub = $this->fileSystem
        ->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)) {
            $this->fileSystem
                ->deleteRecursive($path);
        }
    }
    // Report back the results.
    $this->messenger()
        ->addMessage($this->t('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,
    ]));
}