Commit 67fb78ce authored by Dries's avatar Dries

- Patch #512104 by boombatower: simpletest breaks high volume sites.

parent d258bed2
......@@ -1076,7 +1076,7 @@ protected function setUp() {
variable_set('smtp_library', drupal_get_path('module', 'simpletest') . '/drupal_web_test_case.php');
// Use temporary files directory with the same prefix as database.
variable_set('file_directory_path', $this->originalFileDirectory . '/' . $db_prefix);
variable_set('file_directory_path', $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10));
$directory = file_directory_path();
// Create the files directory.
file_check_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
......
......@@ -360,11 +360,12 @@ function simpletest_clean_database() {
* Find all leftover temporary directories and remove them.
*/
function simpletest_clean_temporary_directories() {
$files = scandir(file_directory_path());
$directory = file_directory_path() . '/simpletest';
$files = scandir($directory);
$count = 0;
foreach ($files as $file) {
$path = file_directory_path() . '/' . $file;
if (is_dir($path) && preg_match('/^simpletest\d+/', $file)) {
$path = "$directory/$file";
if (is_dir($path) && is_numeric($file)) {
file_unmanaged_delete_recursive($path);
$count++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment