diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2015-05-22 14:54:49 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2015-05-22 17:09:26 +0200 |
commit | 422d8026daaae0a9bc7270f071da22f5d66c4f0a (patch) | |
tree | 126128275e8d1938d2a27c45718998cab7528c15 /web | |
parent | 0dcdc23a7f0babd1bc7d1bb31a2ff2b7602d5cdf (diff) | |
download | aur-422d8026daaae0a9bc7270f071da22f5d66c4f0a.tar.gz aur-422d8026daaae0a9bc7270f071da22f5d66c4f0a.tar.xz |
Update co-maintainers when disowning a package
When a user disowns a package, the co-maintainer with the highest
priority automatically becomes the new maintainer. When the package is
disowned by a Trusted User or a Developer, the list of co-maintainers is
cleared.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web')
-rw-r--r-- | web/lib/pkgbasefuncs.inc.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index d10b5ad5..b8da23c4 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -638,6 +638,24 @@ function pkgbase_adopt ($base_ids, $action=true, $via) { $q.= "WHERE ID IN (" . implode(",", $base_ids) . ") "; $dbh->exec($q); + /* Update package co-maintainers when disowning a package. */ + if (!$action) { + if (has_credential(CRED_PKGBASE_DISOWN)) { + foreach ($base_ids as $base_id) { + pkgbase_set_comaintainers($base_id, ""); + } + } else { + foreach ($base_ids as $base_id) { + $uids = pkgbase_get_comaintainers($base_id); + + $q = "UPDATE PackageBases "; + $q.= "SET MaintainerUID = " . $uids[0] . " "; + $q.= "WHERE ID = " . $base_id; + $dbh->exec($q); + } + } + } + if ($action) { pkgbase_notify($base_ids); return array(true, __("The selected packages have been adopted.")); |