summaryrefslogtreecommitdiff
path: root/web/html/pkgsubmit.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-04-04 00:01:44 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-04-05 12:21:35 +0200
commitb7941073acec76e5b4f89648aca1413c15eb067f (patch)
tree753a2484af94f5137825b8e49dc36885fae08eef /web/html/pkgsubmit.php
parent856298755246b3841f102b67ac123bca0f12a7fd (diff)
Add provisional support for package bases
This adds a PackageBases table to the database schema and moves the following fields from the Packages table to PackageBases: * CategoryID * NumVotes * OutOfDateTS * SubmittedTS * ModifiedTS * SubmitterUID * MaintainerUID It also fixes all database accesses to comply with the new layout. Having a separate PackageBases table is the first step to split package support. By now, we create one PackageBases entry per package (where the package base has the same name as the corresponding package). When adding full support for split packages later, the package base name will be derived from the pkgbase variable and a single package base will be shared amongst all packages built from one source package. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/html/pkgsubmit.php')
-rw-r--r--web/html/pkgsubmit.php27
1 files changed, 14 insertions, 13 deletions
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 373af35..38fbb8c 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -354,7 +354,7 @@ if ($uid):
if (!$error) {
# First, see if this package already exists, and if it can be overwritten
$pkg_id = pkgid_from_name($pkg_name);
- if (can_submit_pkg($pkg_name, $_COOKIE["AURSID"])) {
+ if (can_submit_pkgbase($pkg_name, $_COOKIE["AURSID"])) {
if (file_exists($incoming_pkgdir)) {
# Blow away the existing file/dir and contents
rm_tree($incoming_pkgdir);
@@ -409,24 +409,25 @@ if ($uid):
# 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.
- $packageID = $pdata["ID"];
+ $pkgid = $pdata["ID"];
+ $base_id = pkgbase_from_pkgid($pkgid);
# Flush out old data that will be replaced with new data
- remove_pkg_deps($packageID);
- remove_pkg_sources($packageID);
+ remove_pkg_deps($pkgid);
+ remove_pkg_sources($pkgid);
# If a new category was chosen, change it to that
if ($category_id > 1) {
- update_pkg_category($packageID, $category_id);
+ update_pkgbase_category($base_id, $category_id);
}
- # Update package data
- update_pkgdetails($new_pkgbuild['pkgname'], $new_pkgbuild['license'], $pkg_version, $new_pkgbuild['pkgdesc'], $new_pkgbuild['url'], $uid, $packageID);
+ # Update package base and package data
+ update_pkgbase($base_id, $new_pkgbuild['pkgname'], $uid);
+ update_pkg($pkgid, $new_pkgbuild['pkgname'], $new_pkgbuild['license'], $pkg_version, $new_pkgbuild['pkgdesc'], $new_pkgbuild['url']);
} else {
# This is a brand new package
- new_pkgdetails($new_pkgbuild['pkgname'], $new_pkgbuild['license'], $pkg_version, $category_id, $new_pkgbuild['pkgdesc'], $new_pkgbuild['url'], $uid);
- $packageID = last_insert_id();
-
+ $base_id = create_pkgbase($new_pkgbuild['pkgname'], $category_id, $uid);
+ $pkgid = create_pkg($base_id, $new_pkgbuild['pkgname'], $new_pkgbuild['license'], $pkg_version, $new_pkgbuild['pkgdesc'], $new_pkgbuild['url']);
}
# Update package depends
@@ -444,7 +445,7 @@ if ($uid):
else if ($deppkgname == "#") {
break;
}
- add_pkg_dep($packageID, $deppkgname, $depcondition);
+ add_pkg_dep($pkgid, $deppkgname, $depcondition);
}
}
@@ -452,14 +453,14 @@ if ($uid):
if (!empty($new_pkgbuild['source'])) {
$sources = explode(" ", $new_pkgbuild['source']);
foreach ($sources as $src) {
- add_pkg_src($packageID, $src);
+ add_pkg_src($pkgid, $src);
}
}
# If we just created this package, or it was an orphan and we
# auto-adopted, add submitting user to the notification list.
if (!$pdata || $pdata["MaintainerUID"] === NULL) {
- pkg_notify(account_from_sid($_COOKIE["AURSID"]), array($packageID), true);
+ pkg_notify(account_from_sid($_COOKIE["AURSID"]), array($pkgid), true);
}
# Entire package creation process is atomic