From c6e09def2b75762128f432130556ec6121fd8b8c Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 22 May 2015 19:53:19 +0200 Subject: Fix processing of pkgbase_get_comaintainers() pkgbase_get_comaintainers() returns an array of user names, not an array of user IDs. Signed-off-by: Lukas Fleischer --- web/html/pkgdisown.php | 6 +++--- web/lib/pkgbasefuncs.inc.php | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'web') diff --git a/web/html/pkgdisown.php b/web/html/pkgdisown.php index cf7bb41..d4a3714 100644 --- a/web/html/pkgdisown.php +++ b/web/html/pkgdisown.php @@ -11,7 +11,7 @@ check_sid(); html_header(__("Disown Package")); $maintainer_uids = array(pkgbase_maintainer_uid($base_id)); -$comaintainer_uids = pkgbase_get_comaintainers($base_id); +$comaintainers = pkgbase_get_comaintainers($base_id); if (has_credential(CRED_PKGBASE_DISOWN, $maintainer_uids)): ?>
@@ -26,9 +26,9 @@ if (has_credential(CRED_PKGBASE_DISOWN, $maintainer_uids)): ?>

- 0 && !has_credential(CRED_PKGBASE_DISOWN)): ?> + 0 && !has_credential(CRED_PKGBASE_DISOWN)): ?> ', $comaintainer_uids[0], ''); ?> + '', $comaintainers[0], ''); ?> diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index b8da23c..5b8b52f 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -646,12 +646,15 @@ function pkgbase_adopt ($base_ids, $action=true, $via) { } } 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); + $comaintainers = pkgbase_get_comaintainers($base_id); + + if (count($comaintainers) > 0) { + $uid = uid_from_username($comaintainers[0]); + $q = "UPDATE PackageBases "; + $q.= "SET MaintainerUID = " . $uid . " "; + $q.= "WHERE ID = " . $base_id; + $dbh->exec($q); + } } } } -- cgit v1.2.3-70-g09d2