Commit 5eb7354e authored by Johannes Löthberg's avatar Johannes Löthberg Committed by Lukas Fleischer
Browse files

Add functions for getting arrays of maintainer and co-maintainer UIDs


Signed-off-by: Johannes Löthberg's avatarJohannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 2d7b68ac
......@@ -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
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment