summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2011-02-21 17:56:12 +0100
committerLukas Fleischer <archlinux@cryptocrack.de>2011-02-21 17:56:19 +0100
commit31b0b68b479aff1f85feb89010ed3fcf40a95673 (patch)
tree8db950f8d7a7da57eaa81112e885bf7a12b2b66e
parentbc207d25cd47e2ebc0a2d603f0414ca97cf94366 (diff)
downloadaurweb-31b0b68b479aff1f85feb89010ed3fcf40a95673.tar.xz
Automatically adopt when updating an orphan package (fixes FS#22992).
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
-rw-r--r--web/html/pkgsubmit.php12
-rw-r--r--web/lib/aur.inc2
2 files changed, 8 insertions, 6 deletions
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index b55a720..ccbd35e 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -255,15 +255,14 @@ if ($_COOKIE["AURSID"]):
$dbh = db_connect();
- # This is an overwrite of an existing package, the database ID
- # needs to be preserved so that any votes are retained. However,
- # PackageDepends and PackageSources can be purged.
-
$q = "SELECT * FROM Packages WHERE Name = '" . mysql_real_escape_string($new_pkgbuild['pkgname']) . "'";
$result = db_query($q, $dbh);
$pdata = mysql_fetch_assoc($result);
if ($pdata) {
+ # This is an overwrite of an existing package, the database ID
+ # needs to be preserved so that any votes are retained. However,
+ # PackageDepends and PackageSources can be purged.
# Flush out old data that will be replaced with new data
$q = "DELETE FROM PackageDepends WHERE PackageID = " . $pdata["ID"];
@@ -291,13 +290,14 @@ if ($_COOKIE["AURSID"]):
}
# Update package data
- $q = sprintf("UPDATE Packages SET ModifiedTS = UNIX_TIMESTAMP(), Name = '%s', Version = '%s-%s', License = '%s', Description = '%s', URL = '%s', OutOfDateTS = NULL WHERE ID = %d",
+ $q = sprintf("UPDATE Packages SET ModifiedTS = UNIX_TIMESTAMP(), Name = '%s', Version = '%s-%s', License = '%s', Description = '%s', URL = '%s', OutOfDateTS = NULL, MaintainerUID = '%d' WHERE ID = %d",
mysql_real_escape_string($new_pkgbuild['pkgname']),
mysql_real_escape_string($new_pkgbuild['pkgver']),
mysql_real_escape_string($new_pkgbuild['pkgrel']),
mysql_real_escape_string($new_pkgbuild['license']),
mysql_real_escape_string($new_pkgbuild['pkgdesc']),
mysql_real_escape_string($new_pkgbuild['url']),
+ uid_from_sid($_COOKIE["AURSID"]),
$pdata["ID"]);
db_query($q, $dbh);
@@ -329,6 +329,8 @@ if ($_COOKIE["AURSID"]):
}
}
+ if (!$pdata["MaintainerUID"]) pkg_notify(account_from_sid($_COOKIE["AURSID"]), array($pdata["ID"]));
+
header('Location: packages.php?ID=' . $pdata['ID']);
} else {
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index 835b8a8..5a60c4c 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -339,7 +339,7 @@ function can_submit_pkg($name="", $sid="") {
if ($row[1] == "1") { return 1; }
$my_uid = uid_from_sid($sid);
- if ($row[0] == $my_uid) {
+ if (!$row[0] || $row[0] == $my_uid) {
return 1;
}