You are here

public function JsCollectionOptimizer::deleteAll in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php \Drupal\Core\Asset\JsCollectionOptimizer::deleteAll()

Deletes all optimized asset collections assets.

Overrides AssetCollectionOptimizerInterface::deleteAll

File

core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php, line 186
Contains \Drupal\Core\Asset\JsCollectionOptimizer.

Class

JsCollectionOptimizer
Optimizes JavaScript assets.

Namespace

Drupal\Core\Asset

Code

public function deleteAll() {
  $this->state
    ->delete('system.js_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('public://js', '/.*/', array(
    'callback' => $delete_stale,
  ));
}