summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-05-22 14:35:26 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-05-22 17:09:26 +0200
commit2b909cb3f6e19d730cdd560fc1c5d11ddad431c1 (patch)
treead287dec926d934e25404892992b6fbd7045dc95
parent2db1a559226b64c8c424b9ce8aaa17b4cac219ec (diff)
downloadaurweb-2b909cb3f6e19d730cdd560fc1c5d11ddad431c1.tar.xz
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 <lfleischer@archlinux.org>
-rw-r--r--schema/aur-schema.sql1
-rw-r--r--upgrading/4.0.0.txt1
-rw-r--r--web/lib/pkgbasefuncs.inc.php7
3 files changed, 7 insertions, 2 deletions
diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql
index 9c647d8..5641d0d 100644
--- a/schema/aur-schema.sql
+++ b/schema/aur-schema.sql
@@ -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,
diff --git a/upgrading/4.0.0.txt b/upgrading/4.0.0.txt
index 023dec0..9a4a807 100644
--- a/upgrading/4.0.0.txt
+++ b/upgrading/4.0.0.txt
@@ -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,
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 3e4b572..50cb47e 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -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."));