function simpletest_clean_temporary_directories
7.x simpletest.module | simpletest_clean_temporary_directories() |
Find all leftover temporary directories and remove them.
1 call to simpletest_clean_temporary_directories()
- simpletest_clean_environment in drupal-7.x/
modules/ simpletest/ simpletest.module - Remove all temporary database tables and directories.
File
- drupal-7.x/
modules/ simpletest/ simpletest.module, line 561 - Provides testing functionality.
Code
function simpletest_clean_temporary_directories() {
$count = 0;
if (is_dir('public://simpletest')) {
$files = scandir('public://simpletest');
foreach ($files as $file) {
$path = 'public://simpletest/' . $file;
if (is_dir($path) && is_numeric($file)) {
file_unmanaged_delete_recursive($path);
$count++;
}
}
}
if ($count > 0) {
drupal_set_message(format_plural($count, 'Removed 1 temporary directory.', 'Removed @count temporary directories.'));
}
else {
drupal_set_message(t('No temporary directories to remove.'));
}
}