You are here

function _webform_recursive_delete in Webform 6.2

Same name and namespace in other branches
  1. 5.2 webform.install \_webform_recursive_delete()
  2. 5 webform.install \_webform_recursive_delete()
  3. 6.3 webform.install \_webform_recursive_delete()

Recursively delete all files and folders in the specified filepath, then delete the containing folder.

Note that this only deletes visible files with write permission

Parameters

string $path: A filepath relative to file_directory_path

1 call to _webform_recursive_delete()
webform_uninstall in ./webform.install
Implementation of hook_uninstall().

File

./webform.install, line 1026
Webform module install/schema hooks.

Code

function _webform_recursive_delete($path) {
  if ($path) {
    $listing = $path . '/*';
    foreach (glob($listing) as $file) {
      if (is_file($file) === TRUE) {
        @unlink($file);
      }
      elseif (is_dir($file) === TRUE) {
        _webform_recursive_delete($file);
      }
    }
    @rmdir($path);
  }
}