Skip to content
Snippets Groups Projects

Issue #3302407: Fatal error during CSS and JS removal

Merged Lisa Harrison requested to merge issue/flysystem-3302407:flysystem-3302407 into 2.0.x
2 files
+ 14
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -3,6 +3,7 @@
namespace Drupal\flysystem\Asset;
use Drupal\Core\Asset\CssCollectionOptimizer as DrupalCssCollectionOptimizer;
use Drupal\Core\Logger\LoggerChannelTrait;
/**
* Optimizes CSS assets.
@@ -10,6 +11,7 @@ use Drupal\Core\Asset\CssCollectionOptimizer as DrupalCssCollectionOptimizer;
class CssCollectionOptimizer extends DrupalCssCollectionOptimizer {
use SchemeExtensionTrait;
use LoggerChannelTrait;
/**
* {@inheritdoc}
@@ -22,7 +24,11 @@ class CssCollectionOptimizer extends DrupalCssCollectionOptimizer {
// Default stale file threshold is 30 days (2592000 seconds).
$stale_file_threshold = \Drupal::config('system.performance')->get('stale_file_threshold') ?? 2592000;
if (\Drupal::time()->getRequestTime() - filemtime($uri) > $stale_file_threshold) {
$file_system->delete($uri);
try {
$file_system->delete($uri);
} catch (\Exception $e) {
$this->getLogger('flysystem')->error($e->getMessage());
}
}
};
$css_dir = $this->getSchemeForExtension('css') . '://css';
Loading