[aur-dev] [PATCH] Use system rm in rm_rf function.

Loui louipc.ist at gmail.com
Sun Sep 14 11:25:26 EDT 2008


Oops that first attachment was wrong. Here's the correct one.

-------------- next part --------------
>From 0efe7af86c6ee04b66fd855bde436e7f7e5df4cc Mon Sep 17 00:00:00 2001
From: Loui Chang <louipc.ist at gmail.com>
Date: Fri, 12 Sep 2008 20:19:42 -0400
Subject: [PATCH] Use system rm in rm_rf function.

PHP can't properly handle symlinks which causes problems when
self-referencing symlinks appear.

This closes FS#11187.

Signed-off-by: Loui Chang <louipc.ist at gmail.com>
---
 web/lib/aur.inc |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index ade5b82..a126bb9 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -374,19 +374,10 @@ function can_submit_pkg($name="", $sid="") {
 # recursive delete directory
 #
 function rm_rf($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);
-			}
-		}
+	if ($dirname != "") {
+		exec('rm -rf ' . escapeshellcmd($dirname));
 	}
-	$d->close();
-	rmdir($dirname);
+
 	return;
 }
 
-- 
1.6.0.1



More information about the aur-dev mailing list