diff --git a/core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php b/core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php index b7dbbc9b4ef7266f3fc6b6ce29c241b24abc4481..88517a6aaba21ca0c4c0bfb419d899b1444368e0 100644 --- a/core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php +++ b/core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php @@ -143,19 +143,7 @@ public function getAll() { */ public function deleteAll() { $this->state->delete('drupal_css_cache_files'); - - $delete_stale = function ($uri) { - $threshold = $this->configFactory - ->get('system.performance') - ->get('stale_file_threshold'); - // Default stale file threshold is 30 days. - if ($this->time->getRequestTime() - filemtime($uri) > $threshold) { - $this->fileSystem->delete($uri); - } - }; - if (is_dir('assets://css')) { - $this->fileSystem->scanDirectory('assets://css', '/.*/', ['callback' => $delete_stale]); - } + $this->fileSystem->deleteRecursive('assets://css'); } /** diff --git a/core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php b/core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php index 0ed426dc0f1245eda923848fcdca5089f077073d..cff3bb49c5f872799de2bf097eee096d2607d2b7 100644 --- a/core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php +++ b/core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php @@ -158,18 +158,7 @@ public function getAll() { */ public function deleteAll() { $this->state->delete('system.js_cache_files'); - $delete_stale = function ($uri) { - $threshold = $this->configFactory - ->get('system.performance') - ->get('stale_file_threshold'); - // Default stale file threshold is 30 days. - if ($this->time->getRequestTime() - filemtime($uri) > $threshold) { - $this->fileSystem->delete($uri); - } - }; - if (is_dir('assets://js')) { - $this->fileSystem->scanDirectory('assets://js', '/.*/', ['callback' => $delete_stale]); - } + $this->fileSystem->deleteRecursive('assets://js'); } /**