Delete old optimized collection assets.
File
-
src/
Asset/ CssCollectionOptimizer.php, line 275
Class
Namespace
Drupal\advagg\AssetCode
public function deleteOld() {
$log = [];
$this->state
->delete('system.css_cache_files');
Cache::invalidateTags([
'library_info',
]);
$delete_old = function ($uri) use (&$log) {
// Default stale file threshold is 30 days.
// Delete old if > 3 times that.
if (REQUEST_TIME - filemtime($uri) > $this->systemConfig
->get('stale_file_threshold') * 3) {
file_unmanaged_delete($uri);
$log[] = $uri;
}
};
file_scan_directory($this->dumper
->preparePath('css'), '/.*/', [
'callback' => $delete_old,
]);
return $log;
}