mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add functions for getting arrays of maintainer and co-maintainer UIDs
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
2d7b68ac4c
commit
5eb7354e7d
1 changed files with 35 additions and 0 deletions
|
@ -318,6 +318,19 @@ function pkgbase_maintainer_uid($base_id) {
|
|||
return $result->fetch(PDO::FETCH_COLUMN, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the maintainers of an array of package bases given by their ID
|
||||
*
|
||||
* @param int $base_ids The array of IDs of the package bases to query
|
||||
*
|
||||
* @return int The user ID of the current package maintainer
|
||||
*/
|
||||
function pkgbase_maintainer_uids($base_ids) {
|
||||
$dbh = DB::connect();
|
||||
$q = "SELECT MaintainerUID FROM PackageBases WHERE ID IN (" . implode(",", $base_ids) . ")";
|
||||
$result = $dbh->query($q);
|
||||
return $result->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag package(s) as out-of-date
|
||||
|
@ -992,6 +1005,28 @@ function pkgbase_get_comaintainers($base_id) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of package base co-maintainer IDs
|
||||
*
|
||||
* @param int $base_id The package base ID to retrieve the co-maintainers for
|
||||
*
|
||||
* @return array An array of co-maintainer user UDs
|
||||
*/
|
||||
function pkgbase_get_comaintainer_uids($base_ids) {
|
||||
$dbh = DB::connect();
|
||||
$q = "SELECT UsersID FROM PackageComaintainers ";
|
||||
$q .= "INNER JOIN Users ON Users.ID = PackageComaintainers.UsersID ";
|
||||
$q .= "WHERE PackageComaintainers.PackageBaseID IN (" . implode(",", $base_ids) . ") ";
|
||||
$q .= "ORDER BY Priority ASC";
|
||||
$result = $dbh->query($q);
|
||||
|
||||
if ($result) {
|
||||
return $result->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the list of co-maintainers of a package base
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue