[aur-dev] [PATCH] Revert "Use system rm in rm_rf function."
Dan McGee
dan at archlinux.org
Fri Oct 24 17:29:01 EDT 2008
This reverts commit 5c3f01909301f641f57b2ffe8b59609de6be2256. Falling back
to a system function is really dumb when all we need to do is fix the
ordering of things in this function.
Signed-off-by: Dan McGee <dan at archlinux.org>
---
Guys,
I sent the last patches based off of the master branch- looks like I have no
idea how your development works, sorry about that. Anyway here is the series
based off of the testing branch. It still will need some testing.
-Dan
web/lib/aur.inc | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index a126bb9..ade5b82 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -374,10 +374,19 @@ function can_submit_pkg($name="", $sid="") {
# recursive delete directory
#
function rm_rf($dirname="") {
- if ($dirname != "") {
- exec('rm -rf ' . escapeshellcmd($dirname));
+ $d = dir($dirname);
+ while ($f = $d->read()) {
+ if ($f != "." && $f != "..") {
+ if (is_dir($dirname."/".$f)) {
+ rm_rf($dirname."/".$f);
+ }
+ if (is_file($dirname."/".$f) || is_link($dirname."/".$f)) {
+ unlink($dirname."/".$f);
+ }
+ }
}
-
+ $d->close();
+ rmdir($dirname);
return;
}
--
1.6.0.3
More information about the aur-dev
mailing list