function unish_file_delete_recursive

8.0.x bootstrap.inc unish_file_delete_recursive($dir, $force = FALSE, $follow_symlinks = FALSE)
6.x drush_testcase.inc unish_file_delete_recursive($dir, $force = FALSE, $follow_symlinks = FALSE)
7.x bootstrap.inc unish_file_delete_recursive($dir, $force = FALSE, $follow_symlinks = FALSE)
4.x drush_testcase.inc unish_file_delete_recursive($dir)
5.x drush_testcase.inc unish_file_delete_recursive($dir)
master bootstrap.inc unish_file_delete_recursive($dir, $force = TRUE, $follow_symlinks = FALSE)

Same code as drush_delete_dir().

Parameters

string $dir:

Return value

boolean

See also

drush_delete_dir()

4 calls to unish_file_delete_recursive()
Drush_TestCase::setUpBeforeClass in tests/drush_testcase.inc
Assure that each class starts with an empty sandbox directory and a clean environment - http://drupal.org/node/1103568.
Drush_TestCase::tearDownAfterClass in tests/drush_testcase.inc
Runs after each test case. Remove sandbox directory.
pmDownloadCase::testDestination in tests/pmDownloadTest.php
unish_init in tests/drush_testcase.inc

File

tests/drush_testcase.inc, line 332

Code

function unish_file_delete_recursive($dir) {
  if (!file_exists($dir)) {
    return TRUE;
  }
  if (!is_dir($dir)) {
    @chmod($dir, 0777); // Make file writeable
    return unlink($dir);
  }
  foreach (scandir($dir) as $item) {
    if ($item == '.' || $item == '..') {
      continue;
    }
    if (!unish_file_delete_recursive($dir . '/' . $item)) {
      return FALSE;
    }
  }
  return rmdir($dir);
}