summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgbasefuncs.inc.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-06-25 09:29:07 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-06-25 11:34:31 +0200
commitfc1db28c9b1b13c5b9e6baf6d24963081f18f017 (patch)
treed4adc2a358772396febfbc3a9f7c7e8a25536d20 /web/lib/pkgbasefuncs.inc.php
parent8260111bcce49b73bd4973ae80296c913af2631d (diff)
downloadaur-fc1db28c9b1b13c5b9e6baf6d24963081f18f017.tar.gz
aur-fc1db28c9b1b13c5b9e6baf6d24963081f18f017.tar.xz
Allow for closing package requests
This allows Trusted Users to close package requests via the request list. Also, entries are now sorted such that open requests are shown before closed requests. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/pkgbasefuncs.inc.php')
-rw-r--r--web/lib/pkgbasefuncs.inc.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 505bb511..a039f836 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -975,10 +975,12 @@ function pkgbase_request_list() {
$q.= "PackageRequests.PackageBaseID AS BaseID, ";
$q.= "PackageRequests.PackageBaseName AS Name, ";
$q.= "RequestTypes.Name AS Type, PackageRequests.Comments, ";
- $q.= "Users.Username AS User, PackageRequests.RequestTS ";
+ $q.= "Users.Username AS User, PackageRequests.RequestTS, ";
+ $q.= "PackageRequests.Status ";
$q.= "FROM PackageRequests INNER JOIN RequestTypes ON ";
$q.= "RequestTypes.ID = PackageRequests.ReqTypeID ";
- $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID";
+ $q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID ";
+ $q.= "ORDER BY Status ASC, RequestTS DESC";
return $dbh->query($q)->fetchAll();
}
@@ -1070,3 +1072,23 @@ function pkgbase_file_request($ids, $type, $comments) {
return array(true, __("Added request successfully."));
}
+
+/**
+ * Close a deletion/orphan request
+ *
+ * @param int $id The package request to close
+ *
+ * @return void
+ */
+function pkgbase_close_request($id) {
+ $dbh = DB::connect();
+
+ if (!check_user_privileges()) {
+ return array(false, __("Only TUs and developers can close requests."));
+ }
+
+ $q = "UPDATE PackageRequests SET Status = 1 WHERE ID = " . intval($id);
+ $dbh->exec($q);
+
+ return array(true, __("Request closed successfully."));
+}