diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2015-03-04 12:15:05 +0100 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2015-03-04 12:16:33 +0100 |
commit | 5dca715c46669a2e1ed193c13aacff03e7e237ff (patch) | |
tree | f811defc5fa84f4532a0197633eca08ec2b5e655 /web/lib/pkgreqfuncs.inc.php | |
parent | 84061604aade7224b4f9e3e998c18395e5d1d351 (diff) | |
download | aurweb-5dca715c46669a2e1ed193c13aacff03e7e237ff.tar.xz |
Allow users to delete their own packages
Allow users to remove their own package bases for a short period of time
after initial submission (defaults to one day).
Implements FS#43648.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/pkgreqfuncs.inc.php')
-rw-r--r-- | web/lib/pkgreqfuncs.inc.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php index a5d6be8..0fab447 100644 --- a/web/lib/pkgreqfuncs.inc.php +++ b/web/lib/pkgreqfuncs.inc.php @@ -184,6 +184,7 @@ function pkgreq_file($ids, $type, $merge_into, $comments) { " Request for " . $row['Name'], $body, $headers); $auto_orphan_age = config_get('options', 'auto_orphan_age'); + $auto_delete_age = config_get('options', 'auto_delete_age'); $details = pkgbase_get_details($base_id); if ($type == 'orphan' && $details['OutOfDateTS'] > 0 && time() - $details['OutOfDateTS'] >= $auto_orphan_age && @@ -201,6 +202,19 @@ function pkgreq_file($ids, $type, $merge_into, $comments) { $q = "UPDATE PackageBases SET MaintainerUID = NULL "; $q.= "WHERE ID = " . $base_id; $dbh->exec($q); + } else if ($type == 'deletion' && $details['MaintainerUID'] == $uid && + $details['SubmittedTS'] > 0 && $auto_delete_age > 0 && + time() - $details['SubmittedTS'] <= $auto_delete_age) { + /* + * Close package request. NOTE: This needs to happen *before* + * the actual deletion operation. Otherwise, the former + * maintainer will not be included in the Cc list of the + * request notification email. + */ + pkgreq_close($request_id, "accepted", + "Deletion of a fresh package requested by its " . + "current maintainer.", true); + pkgbase_delete(array($base_id), NULL, NULL, true); } return array(true, __("Added request successfully.")); |