function hackedProjectWebDownloader::remove_dir in Hacked! 6.2
Same name and namespace in other branches
- 7.2 includes/hackedProjectWebDownloader.inc \hackedProjectWebDownloader::remove_dir()
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 hackedProjectWebDownloader::remove_dir()
- hackedProjectWebCVSDownloader::download in includes/
hacked_project.inc - Download the remote files to the local filesystem.
File
- includes/
hacked_project.inc, line 411
Class
- hackedProjectWebDownloader
- Base class for downloading remote versions of projects.
Code
function remove_dir($path) {
if (is_file($path) || is_link($path)) {
unlink($path);
}
elseif (is_dir($path)) {
$d = dir($path);
while (($entry = $d
->read()) !== FALSE) {
if ($entry == '.' || $entry == '..') {
continue;
}
$entry_path = $path . '/' . $entry;
$this
->remove_dir($entry_path);
}
$d
->close();
rmdir($path);
}
else {
watchdog('hacked', 'Unknown file type(%path) stat: %stat ', array(
'%path' => $path,
'%stat' => print_r(stat($path), 1),
), WATCHDOG_ERROR);
}
}