summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-07-28 20:59:05 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2011-08-10 14:34:06 +0200
commit1e20af9aed1bdd39b6eead4bf74d97e984b3297e (patch)
tree13b5f8ac47acf43513819bcd34a3069026ea62f2 /scripts
parent16cda58ff85aa3ae3534a2fe1fd0c998e01e8bb4 (diff)
downloadaur-1e20af9aed1bdd39b6eead4bf74d97e984b3297e.tar.gz
aur-1e20af9aed1bdd39b6eead4bf74d97e984b3297e.tar.xz
scripts/cleanup: use native PHP only
No need to shell out to the system here. Also fix the script so it actually works. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/cleanup20
1 files changed, 11 insertions, 9 deletions
diff --git a/scripts/cleanup b/scripts/cleanup
index 4fc9ea2d..f2873501 100755
--- a/scripts/cleanup
+++ b/scripts/cleanup
@@ -16,21 +16,23 @@ if (empty($dir)) {
}
set_include_path(get_include_path() . PATH_SEPARATOR . "$dir/lib");
-include("config.inc");
-include("aur.inc");
-include("pkgfuncs.inc");
-
-exec('ls ' . INCOMING_DIR, $files);
+include("config.inc.php");
+include("aur.inc.php");
+include("pkgfuncs.inc.php");
$count = 0;
+$files = scandir(INCOMING_DIR);
foreach ($files as $pkgname) {
- if (!package_exists($pkgname)) {
- echo 'Removing ' . INCOMING_DIR . "$pkgname\n";
- system('rm -r ' . INCOMING_DIR . $pkgname);
+ if ($pkgname == '.' || $pkgname == '..') {
+ continue;
+ }
+ $fullpath = INCOMING_DIR . $pkgname;
+ if (!package_exists($pkgname) && is_dir($fullpath)) {
+ echo 'Removing ' . $fullpath . "\n";
+ rm_tree($fullpath);
$count++;
}
}
echo "\nRemoved $count directories.\n";
-