public function JsCollectionOptimizer::deleteAll in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php \Drupal\Core\Asset\JsCollectionOptimizer::deleteAll()
- 9 core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php \Drupal\Core\Asset\JsCollectionOptimizer::deleteAll()
File
- core/
lib/ Drupal/ Core/ Asset/ JsCollectionOptimizer.php, line 189
Class
- JsCollectionOptimizer
- Optimizes JavaScript assets.
Namespace
Drupal\Core\AssetCode
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')) {
$this->fileSystem
->delete($uri);
}
};
if (is_dir('public://js')) {
$this->fileSystem
->scanDirectory('public://js', '/.*/', [
'callback' => $delete_stale,
]);
}
}