You are here

public function FileProfilerStorage::purge in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php \Symfony\Component\HttpKernel\Profiler\FileProfilerStorage::purge()

Purges all data from the database.

Overrides ProfilerStorageInterface::purge

File

vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php, line 102

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);
    }
  }
}