mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add a parameter to skip old requests to pkgreq_list()
Allow for hiding requests which were opened before a given time stamp. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
f4176a8ce1
commit
b3fdd3f803
1 changed files with 12 additions and 5 deletions
|
@ -20,10 +20,11 @@ function pkgreq_count() {
|
||||||
* @param int $offset The index of the first request to return
|
* @param int $offset The index of the first request to return
|
||||||
* @param int $limit The maximum number of requests to return
|
* @param int $limit The maximum number of requests to return
|
||||||
* @param int $uid Only return packages affecting the given user
|
* @param int $uid Only return packages affecting the given user
|
||||||
|
* @param int $from Do not return packages older than the given date
|
||||||
*
|
*
|
||||||
* @return array List of pacakge requests with details
|
* @return array List of package requests with details
|
||||||
*/
|
*/
|
||||||
function pkgreq_list($offset, $limit, $uid=false) {
|
function pkgreq_list($offset, $limit, $uid=false, $from=false) {
|
||||||
$dbh = DB::connect();
|
$dbh = DB::connect();
|
||||||
|
|
||||||
$q = "SELECT PackageRequests.ID, ";
|
$q = "SELECT PackageRequests.ID, ";
|
||||||
|
@ -37,9 +38,15 @@ function pkgreq_list($offset, $limit, $uid=false) {
|
||||||
$q.= "RequestTypes.ID = PackageRequests.ReqTypeID ";
|
$q.= "RequestTypes.ID = PackageRequests.ReqTypeID ";
|
||||||
$q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID ";
|
$q.= "INNER JOIN Users ON Users.ID = PackageRequests.UsersID ";
|
||||||
|
|
||||||
if ($uid) {
|
if ($uid || $from) {
|
||||||
$q.= "WHERE PackageRequests.UsersID = " . intval($uid). " ";
|
$q.= "WHERE ";
|
||||||
$q.= "OR Users.ID = " . intval($uid) . " ";
|
if ($uid) {
|
||||||
|
$q.= "(PackageRequests.UsersID = " . intval($uid). " ";
|
||||||
|
$q.= "OR Users.ID = " . intval($uid) . ") AND ";
|
||||||
|
}
|
||||||
|
if ($from) {
|
||||||
|
$q.= "RequestTS >= " . intval($from). " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$q.= "ORDER BY Open DESC, RequestTS DESC ";
|
$q.= "ORDER BY Open DESC, RequestTS DESC ";
|
||||||
|
|
Loading…
Add table
Reference in a new issue