public function FileProfilerStorage::purge

Purges all data from the database.

Overrides ProfilerStorageInterface::purge

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php, line 98

Class

FileProfilerStorage
Storage for profiler using files.

Namespace

Symfony\Component\HttpKernel\Profiler

Code

public function purge() {
  $flags = \FilesystemIterator::SKIP_DOTS;
  $iterator = new \RecursiveDirectoryIterator($this->folder, $flags);
  $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST);
  foreach ($iterator as $file) {
    if (is_file($file)) {
      unlink($file);
    }
    else {
      rmdir($file);
    }
  }
}