Commit 2b909cb3 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Store co-maintainer priorities



In addition to saving the list of package co-maintainers, also save
their order. This makes it possible to define a "primary" co-maintainer.

Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 2db1a559
......@@ -281,6 +281,7 @@ CREATE TABLE PackageComments (
CREATE TABLE PackageComaintainers (
UsersID INTEGER UNSIGNED NOT NULL,
PackageBaseID INTEGER UNSIGNED NOT NULL,
Priority INTEGER UNSIGNED NOT NULL,
INDEX (UsersID),
INDEX (PackageBaseID),
FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
......
......@@ -26,6 +26,7 @@ UPDATE PackageBases SET PackagerUID = NULL;
CREATE TABLE PackageComaintainers (
UsersID INTEGER UNSIGNED NOT NULL,
PackageBaseID INTEGER UNSIGNED NOT NULL,
Priority INTEGER UNSIGNED NOT NULL,
INDEX (UsersID),
INDEX (PackageBaseID),
FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
......
......@@ -967,7 +967,8 @@ function pkgbase_get_comaintainers($base_id) {
$dbh = DB::connect();
$q = "SELECT UserName FROM PackageComaintainers ";
$q .= "INNER JOIN Users ON Users.ID = PackageComaintainers.UsersID ";
$q .= "WHERE PackageComaintainers.PackageBaseID = " . intval($base_id);
$q .= "WHERE PackageComaintainers.PackageBaseID = " . intval($base_id) . " ";
$q .= "ORDER BY Priority ASC";
$result = $dbh->query($q);
if ($result) {
......@@ -1012,9 +1013,11 @@ function pkgbase_set_comaintainers($base_id, $users) {
$q = sprintf("DELETE FROM PackageComaintainers WHERE PackageBaseID = %d", $base_id);
$dbh->exec($q);
$i = 1;
foreach ($uids as $uid) {
$q = sprintf("INSERT INTO PackageComaintainers (PackageBaseID, UsersID) VALUES (%d, %d)", $base_id, $uid);
$q = sprintf("INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (%d, %d, %d)", $base_id, $uid, $i);
$dbh->exec($q);
$i++;
}
return array(true, __("The package base co-maintainers have been updated."));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment