summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-06-20 12:44:36 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-06-20 14:26:59 +0200
commit5eb7354e7d67833ec3ef582bb9ef74550f60f318 (patch)
tree2d471374b04931668f68dfed237e943010843bcb
parent2d7b68ac4c3ab60bd190e7ff704bbe2b8d6deafc (diff)
downloadaur-5eb7354e7d67833ec3ef582bb9ef74550f60f318.tar.gz
aur-5eb7354e7d67833ec3ef582bb9ef74550f60f318.tar.xz
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>
-rw-r--r--web/lib/pkgbasefuncs.inc.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index c8c99ebb..d12a2286 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -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
@@ -993,6 +1006,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
*
* @param int $base_id The package base ID to update the co-maintainers of