Update cleanup script to remove non-unsupported files.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
Loui Chang 2009-03-03 11:21:08 -05:00
parent 701186ad05
commit bbc05414cf
2 changed files with 16 additions and 1 deletions

View file

@ -25,7 +25,7 @@ exec('ls ' . INCOMING_DIR, $files);
$count = 0; $count = 0;
foreach ($files as $pkgname) { foreach ($files as $pkgname) {
if (!package_exists($pkgname)) { if (package_location($pkgname) != 'unsupported') {
echo 'Removing ' . INCOMING_DIR . "$pkgname\n"; echo 'Removing ' . INCOMING_DIR . "$pkgname\n";
system('rm -r ' . INCOMING_DIR . $pkgname); system('rm -r ' . INCOMING_DIR . $pkgname);
$count++; $count++;

View file

@ -84,6 +84,21 @@ function pkgLocations() {
return $locs; return $locs;
} }
# Return the repository name for a particular package.
function package_location($name="") {
if (!$name) {return NULL;}
$dbh = db_connect();
$q = "SELECT PackageLocations.Location FROM Packages ";
$q.= "LEFT JOIN PackageLocations ON ";
$q.= "Packages.LocationID = PackageLocations.ID ";
$q.= "WHERE Name = '".mysql_real_escape_string($name)."' ";
$q.= "AND DummyPkg = 0";
$result = db_query($q, $dbh);
if (!$result) {return NULL;}
$row = mysql_fetch_row($result);
return $row[0];
}
# check to see if the package name exists # check to see if the package name exists
# #
function package_exists($name="") { function package_exists($name="") {