CssCollectionOptimizer::deleteAll

public CssCollectionOptimizer::deleteAll()

Deletes all optimized asset collections assets.

Overrides AssetCollectionOptimizerInterface::deleteAll

File

core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php, line 175

Class

CssCollectionOptimizer
Optimizes CSS assets.

Namespace

Drupal\Core\Asset

Code

public function deleteAll() {
  $this->state->delete('drupal_css_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')) {
      file_unmanaged_delete($uri);
    }
  };
  file_scan_directory('public://css', '/.*/', array('callback' => $delete_stale));
}
doc_Drupal
2016-10-29 08:59:15
Comments
Leave a Comment

Please login to continue.