You are here

public function DrupalCacheAdapter::deleteDir in Flysystem 8

Same name and namespace in other branches
  1. 3.x src/Flysystem/Adapter/DrupalCacheAdapter.php \Drupal\flysystem\Flysystem\Adapter\DrupalCacheAdapter::deleteDir()
  2. 2.0.x src/Flysystem/Adapter/DrupalCacheAdapter.php \Drupal\flysystem\Flysystem\Adapter\DrupalCacheAdapter::deleteDir()
  3. 3.0.x src/Flysystem/Adapter/DrupalCacheAdapter.php \Drupal\flysystem\Flysystem\Adapter\DrupalCacheAdapter::deleteDir()

File

src/Flysystem/Adapter/DrupalCacheAdapter.php, line 133

Class

DrupalCacheAdapter
A Flysystem adapter implementing caching with Drupal's Cache API.

Namespace

Drupal\flysystem\Flysystem\Adapter

Code

public function deleteDir($dirname) {

  // Before the delete we need to know what files are in the directory.
  $contents = $this->adapter
    ->listContents($dirname, TRUE);
  $result = $this->adapter
    ->deleteDir($dirname);
  if ($result) {
    $paths = array_column($contents, 'path');
    $this->cacheItemBackend
      ->deleteMultiple($paths);
  }
  return $result;
}