public static function HttpCacheTestCase::clearDirectory

4 calls to HttpCacheTestCase::clearDirectory()
HttpCacheTestCase::setUp in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php
HttpCacheTestCase::tearDown in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php
StoreTest::setUp in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php
StoreTest::tearDown in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php, line 157

Class

HttpCacheTestCase

Namespace

Symfony\Component\HttpKernel\Tests\HttpCache

Code

public static function clearDirectory($directory) {
  if (!is_dir($directory)) {
    return;
  }
  $fp = opendir($directory);
  while (false !== ($file = readdir($fp))) {
    if (!in_array($file, array(
      '.',
      '..',
    ))) {
      if (is_link($directory . '/' . $file)) {
        unlink($directory . '/' . $file);
      }
      elseif (is_dir($directory . '/' . $file)) {
        self::clearDirectory($directory . '/' . $file);
        rmdir($directory . '/' . $file);
      }
      else {
        unlink($directory . '/' . $file);
      }
    }
  }
  closedir($fp);
}