function _webform_recursive_delete in Webform 5.2
Same name and namespace in other branches
- 5 webform.install \_webform_recursive_delete()
- 6.3 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 - Implementation of hook_uninstall().
File
- ./
webform.install, line 800
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);
}
}