mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Describe what this function actually does: Return the ID of a package with a given name and return NULL if such a package doesn't exist. The function name is chosen in a fashion similar to other functions from "pkgfuncs.inc.php" (pkgname_from_id(), pkgnotify_from_sid(), ...). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
45 lines
1 KiB
PHP
Executable file
45 lines
1 KiB
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.php");
|
|
include("aur.inc.php");
|
|
include("pkgfuncs.inc.php");
|
|
|
|
$count = 0;
|
|
|
|
$buckets = scandir(INCOMING_DIR);
|
|
foreach ($buckets as $bucket) {
|
|
$bucketpath = INCOMING_DIR . $bucket;
|
|
if ($bucket == '.' || $bucket == '..' || !is_dir($bucketpath)) {
|
|
continue;
|
|
}
|
|
$files = scandir(INCOMING_DIR . $bucket);
|
|
foreach ($files as $pkgname) {
|
|
if ($pkgname == '.' || $pkgname == '..') {
|
|
continue;
|
|
}
|
|
$fullpath = INCOMING_DIR . $bucket . "/" . $pkgname;
|
|
if (!pkgid_from_name($pkgname) && is_dir($fullpath)) {
|
|
echo 'Removing ' . $fullpath . "\n";
|
|
rm_tree($fullpath);
|
|
$count++;
|
|
}
|
|
}
|
|
}
|
|
|
|
echo "\nRemoved $count directories.\n";
|