You are here

function simpletest_clean_temporary_directory in SimpleTest 6

Remove all files from specified firectory and then remove directory.

Parameters

string $path Directory path.:

1 call to simpletest_clean_temporary_directory()
simpletest_clean_temporary_directories in ./simpletest.module
Find all left over temporary directories and remove them.

File

./simpletest.module, line 294

Code

function simpletest_clean_temporary_directory($path) {
  $files = scandir($path);
  foreach ($files as $file) {
    if ($file != '.' && $file != '..') {
      $file_path = "{$path}/{$file}";
      if (is_dir($file_path)) {
        simpletest_clean_temporary_directory($file_path);
      }
      else {
        file_delete($file_path);
      }
    }
  }
  rmdir($path);
}