mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Automatically close requests
Close requests automatically when a package is deleted or orphaned. Implements FS#43799. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
5dca715c46
commit
a53241a2f1
2 changed files with 51 additions and 1 deletions
|
@ -41,6 +41,27 @@ function pkgreq_list($offset, $limit) {
|
|||
return $dbh->query($q)->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all open package requests belonging to a certain package base
|
||||
*
|
||||
* @param int $baseid The package base ID to retrieve requests for
|
||||
* @param int $type The type of requests to obtain
|
||||
*
|
||||
* @return array List of package request IDs
|
||||
*/
|
||||
function pkgreq_by_pkgbase($baseid, $type) {
|
||||
$dbh = DB::connect();
|
||||
|
||||
$q = "SELECT PackageRequests.ID ";
|
||||
$q.= "FROM PackageRequests INNER JOIN RequestTypes ON ";
|
||||
$q.= "RequestTypes.ID = PackageRequests.ReqTypeID ";
|
||||
$q.= "WHERE PackageRequests.Status = 0 ";
|
||||
$q.= "AND PackageRequests.PackageBaseID = " . intval($baseid) . " ";
|
||||
$q.= "AND RequestTypes.Name = " . $dbh->quote($type);
|
||||
|
||||
return $dbh->query($q)->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the package base that belongs to a package request.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue