You are here

function _webform_recursive_delete in Webform 5

Same name and namespace in other branches
  1. 5.2 webform.install \_webform_recursive_delete()
  2. 6.3 webform.install \_webform_recursive_delete()
  3. 6.2 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
Implmentation of hook_uninstall

File

./webform.install, line 516

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);
  }
}