mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
16cda58ff8
commit
1e20af9aed
1 changed files with 11 additions and 9 deletions
|
@ -16,21 +16,23 @@ if (empty($dir)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . "$dir/lib");
|
set_include_path(get_include_path() . PATH_SEPARATOR . "$dir/lib");
|
||||||
include("config.inc");
|
include("config.inc.php");
|
||||||
include("aur.inc");
|
include("aur.inc.php");
|
||||||
include("pkgfuncs.inc");
|
include("pkgfuncs.inc.php");
|
||||||
|
|
||||||
exec('ls ' . INCOMING_DIR, $files);
|
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
|
$files = scandir(INCOMING_DIR);
|
||||||
foreach ($files as $pkgname) {
|
foreach ($files as $pkgname) {
|
||||||
if (!package_exists($pkgname)) {
|
if ($pkgname == '.' || $pkgname == '..') {
|
||||||
echo 'Removing ' . INCOMING_DIR . "$pkgname\n";
|
continue;
|
||||||
system('rm -r ' . INCOMING_DIR . $pkgname);
|
}
|
||||||
|
$fullpath = INCOMING_DIR . $pkgname;
|
||||||
|
if (!package_exists($pkgname) && is_dir($fullpath)) {
|
||||||
|
echo 'Removing ' . $fullpath . "\n";
|
||||||
|
rm_tree($fullpath);
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\nRemoved $count directories.\n";
|
echo "\nRemoved $count directories.\n";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue