You are here

public function CssCollectionOptimizer::deleteAll in Flysystem 8

Same name and namespace in other branches
  1. 3.x src/Asset/CssCollectionOptimizer.php \Drupal\flysystem\Asset\CssCollectionOptimizer::deleteAll()
  2. 2.0.x src/Asset/CssCollectionOptimizer.php \Drupal\flysystem\Asset\CssCollectionOptimizer::deleteAll()
  3. 3.0.x src/Asset/CssCollectionOptimizer.php \Drupal\flysystem\Asset\CssCollectionOptimizer::deleteAll()

Deletes all optimized asset collections assets.

Overrides CssCollectionOptimizer::deleteAll

File

src/Asset/CssCollectionOptimizer.php, line 21

Class

CssCollectionOptimizer
Optimizes CSS assets.

Namespace

Drupal\flysystem\Asset

Code

public function deleteAll() {
  $this->state
    ->delete('drupal_css_cache_files');
  $delete_stale = function ($uri) {

    // Default stale file threshold is 30 days.
    if (REQUEST_TIME - filemtime($uri) > \Drupal::config('system.performance')
      ->get('stale_file_threshold')) {
      file_unmanaged_delete($uri);
    }
  };
  file_scan_directory($this
    ->getSchemeForExtension('css') . '://css', '/.*/', [
    'callback' => $delete_stale,
  ]);
}