You are here

function simpletest_clean_temporary_directories in SimpleTest 6

Same name and namespace in other branches
  1. 8.3 simpletest.module \simpletest_clean_temporary_directories()
  2. 6.2 simpletest.module \simpletest_clean_temporary_directories()
  3. 7.2 simpletest.module \simpletest_clean_temporary_directories()
  4. 7 simpletest.module \simpletest_clean_temporary_directories()

Find all left over temporary directories and remove them.

1 call to simpletest_clean_temporary_directories()
simpletest_clean_environment in ./simpletest.module
Remove all temporary database tables and directories.

File

./simpletest.module, line 270

Code

function simpletest_clean_temporary_directories() {
  $files = scandir(file_directory_path());
  $count = 0;
  foreach ($files as $file) {
    $path = file_directory_path() . '/' . $file;
    if (is_dir($path) && preg_match('/^simpletest\\d+/', $file)) {
      simpletest_clean_temporary_directory($path);
      $count++;
    }
  }
  if ($count > 0) {
    drupal_set_message(t('Removed @count temporary directories.', array(
      '@count' => $count,
    )));
  }
  else {
    drupal_set_message(t('No temporary directories to remove.'));
  }
}