3 # Run this script by providing it with the top path of AUR.
4 # In that path you should see a file lib/aur.inc
6 # This will remove files which belong to deleted packages
9 # ex: php cleanup dev/aur/web
14 echo "Please specify AUR directory.\n";
18 set_include_path(get_include_path() . PATH_SEPARATOR
. "$dir/lib");
19 include("config.inc.php");
20 include("aur.inc.php");
21 include("pkgfuncs.inc.php");
25 $buckets = scandir(INCOMING_DIR
);
26 foreach ($buckets as $bucket) {
27 $bucketpath = INCOMING_DIR
. $bucket;
28 if ($bucket == '.' ||
$bucket == '..' ||
!is_dir($bucketpath)) {
31 $files = scandir(INCOMING_DIR
. $bucket);
32 foreach ($files as $pkgname) {
33 if ($pkgname == '.' ||
$pkgname == '..') {
36 $fullpath = INCOMING_DIR
. $bucket . "/" . $pkgname;
37 if (!pkgid_from_name($pkgname) && is_dir($fullpath)) {
38 echo 'Removing ' . $fullpath . "\n";
45 echo "\nRemoved $count directories.\n";