You are here

public function BackgroundImageManager::cacheFlush in Background Image 2.0.x

Same name and namespace in other branches
  1. 8 src/BackgroundImageManager.php \Drupal\background_image\BackgroundImageManager::cacheFlush()
  2. 2.x src/BackgroundImageManager.php \Drupal\background_image\BackgroundImageManager::cacheFlush()

Flushes the cache.

Overrides BackgroundImageManagerInterface::cacheFlush

File

src/BackgroundImageManager.php, line 214

Class

BackgroundImageManager

Namespace

Drupal\background_image

Code

public function cacheFlush() {
  $this->fileSystem
    ->scanDirectory('public://background_image/css', '/.*/', [
    'callback' => function ($uri) {
      try {

        // Silence any PHP errors, meant to be passive.
        @$this->fileSystem
          ->deleteRecursive($uri);
      } catch (FileException $e) {

        // Intentionally do nothing.
      }
    },
  ]);
}