aurweb/scripts/cleanup
Dan McGee 7f5af61c88 Drop PackageLocations table and references
We don't need this anymore since all packages managed here are
well...managed here. Rip out all of the places we were using this field,
many of which depended on the magic value '2' anyway.

On the display side of things, we had a column that was always showing
'unsupported' that is now gone, and you can no longer sort by this column.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-02-01 12:41:08 +01:00

36 lines
737 B
PHP
Executable file

#!/usr/bin/php
<?php
# Run this script by providing it with the top path of AUR.
# In that path you should see a file lib/aur.inc
#
# This will remove files which belong to deleted packages
# in unsupported.
#
# ex: php cleanup dev/aur/web
#
$dir = $argv[1];
if (empty($dir)) {
echo "Please specify AUR directory.\n";
exit;
}
set_include_path(get_include_path() . PATH_SEPARATOR . "$dir/lib");
include("config.inc");
include("aur.inc");
include("pkgfuncs.inc");
exec('ls ' . INCOMING_DIR, $files);
$count = 0;
foreach ($files as $pkgname) {
if (!package_exists($pkgname)) {
echo 'Removing ' . INCOMING_DIR . "$pkgname\n";
system('rm -r ' . INCOMING_DIR . $pkgname);
$count++;
}
}
echo "\nRemoved $count directories.\n";