function _webform_recursive_delete in Webform 6.3
Same name and namespace in other branches
- 5.2 webform.install \_webform_recursive_delete()
- 5 webform.install \_webform_recursive_delete()
- 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 - Implements hook_uninstall().
File
- ./
webform.install, line 1539 - Webform module install/schema hooks.
Code
function _webform_recursive_delete($path) {
if ($path && is_dir($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);
}
}