You are here

public function JsCollectionOptimizer::deleteAllReal in Advanced CSS/JS Aggregation 8.2

Deletes all optimized collection assets.

Note: Core's deleteAll() only deletes old files not all.

File

src/Asset/JsCollectionOptimizer.php, line 198

Class

JsCollectionOptimizer

Namespace

Drupal\advagg\Asset

Code

public function deleteAllReal() {
  $log = [];
  $this->state
    ->delete('system.js_cache_files');
  Cache::invalidateTags([
    'library_info',
  ]);
  $delete_all = function ($uri) use (&$log) {
    file_unmanaged_delete($uri);
    $log[] = $uri;
  };
  $this->state
    ->delete('system.js_cache_files');
  file_scan_directory($this->dumper
    ->preparePath('js'), '/.*/', [
    'callback' => $delete_all,
  ]);
  return $log;
}