diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2015-08-31 18:29:06 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2015-09-11 22:14:26 +0200 |
commit | 396e50bdc88feae9d0048d1c3dab776388d96dc7 (patch) | |
tree | 27ba246621007f32e13cf1ad4bdcea756d93ef6d /web/lib/pkgbasefuncs.inc.php | |
parent | 6b7e26a2d19c53438a9594ee3068f1afcdb1ee0d (diff) | |
download | aur-396e50bdc88feae9d0048d1c3dab776388d96dc7.tar.gz aur-396e50bdc88feae9d0048d1c3dab776388d96dc7.tar.xz |
Require comments when flagging packages out-of-date
Implements FS#42827.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/pkgbasefuncs.inc.php')
-rw-r--r-- | web/lib/pkgbasefuncs.inc.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 24d3393f..799f1da9 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -316,10 +316,11 @@ function pkgbase_maintainer_uids($base_ids) { * Flag package(s) as out-of-date * * @param array $base_ids Array of package base IDs to flag/unflag + * @param string $comment The comment to add * * @return array Tuple of success/failure indicator and error message */ -function pkgbase_flag($base_ids) { +function pkgbase_flag($base_ids, $comment) { if (!has_credential(CRED_PKGBASE_FLAG)) { return array(false, __("You must be logged in before you can flag packages.")); } @@ -332,14 +333,15 @@ function pkgbase_flag($base_ids) { $uid = uid_from_sid($_COOKIE['AURSID']); $dbh = DB::connect(); - $q = "UPDATE PackageBases SET"; - $q.= " OutOfDateTS = UNIX_TIMESTAMP(), FlaggerUID = " . $uid; - $q.= " WHERE ID IN (" . implode(",", $base_ids) . ")"; - $q.= " AND OutOfDateTS IS NULL"; + $q = "UPDATE PackageBases SET "; + $q.= "OutOfDateTS = UNIX_TIMESTAMP(), FlaggerUID = " . $uid . ", "; + $q.= "FlaggerComment = " . $dbh->quote($comment) . " "; + $q.= "WHERE ID IN (" . implode(",", $base_ids) . ") "; + $q.= "AND OutOfDateTS IS NULL"; $dbh->exec($q); foreach ($base_ids as $base_id) { - notify(array('flag', $uid, $base_id)); + notify(array('flag', $uid, $base_id), $comment); } return array(true, __("The selected packages have been flagged out-of-date.")); |