diff options
Diffstat (limited to 'web/lib/aur.inc')
-rw-r--r-- | web/lib/aur.inc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/web/lib/aur.inc b/web/lib/aur.inc index a6292caa..835b8a85 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -348,11 +348,23 @@ function can_submit_pkg($name="", $sid="") { # recursive delete directory # -function rm_rf($dirname="") { - if ($dirname != "") { - exec('rm -rf ' . escapeshellcmd($dirname)); +function rm_tree($dirname) { + if (empty($dirname) || !is_dir($dirname)) return; + + foreach (scandir($dirname) as $item) { + if ($item != '.' && $item != '..') { + $path = $dirname . '/' . $item; + if (is_file($path) || is_link($path)) { + unlink($path); + } + else { + rm_tree($path); + } + } } + rmdir($dirname); + return; } |