From f2933175b648eb8fbd28d1dfff37b848447ca5be Mon Sep 17 00:00:00 2001 From: Lauri Eskola <lauri.eskola@acquia.com> Date: Wed, 5 Jul 2023 20:14:28 +0300 Subject: [PATCH] Issue #3301573 by catch, ravi.shankar, mrinalini9, mherchel, lauriii, alexpott, nod_, acbramley, nsciacca, kevinquillen, Chi: Remove the aggregate stale file threshold and state entry --- .../Core/Asset/CssCollectionOptimizerLazy.php | 14 +------------- .../Core/Asset/JsCollectionOptimizerLazy.php | 13 +------------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php b/core/lib/Drupal/Core/Asset/CssCollectionOptimizerLazy.php index b7dbbc9b4ef7..88517a6aaba2 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 0ed426dc0f12..cff3bb49c5f8 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'); } /** -- GitLab