Remove Dummy Package concept

Instead, we just store dependencies directly in the PackageDepends
table. Since we don't use this info anywhere besides the package details
page, there is little value in precalculating what is in the AUR vs.
what is not.

An upgrade path is provided via several SQL statements in the UPGRADING
document. There should be no user-visible change from this, but the DB
schema gets a bit more sane and we no longer have loads of junk packages
in our tables that are never shown to the end user. This should also
help the MySQL query planner in several cases as we no longer have to be
careful to exclude dummy packages on every query.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Dan McGee 2011-03-30 20:48:09 -05:00 committed by Lukas Fleischer
parent 1f252eba64
commit 7c91c59245
10 changed files with 41 additions and 84 deletions

View file

@ -311,16 +311,6 @@ if ($_COOKIE["AURSID"]):
$q = "DELETE FROM PackageSources WHERE PackageID = " . $packageID;
db_query($q, $dbh);
# If the package was a dummy, undummy it
if ($pdata['DummyPkg']) {
$q = sprintf( "UPDATE Packages SET DummyPkg = 0, SubmitterUID = %d, MaintainerUID = %d, SubmittedTS = UNIX_TIMESTAMP() WHERE ID = %d",
$uid,
$uid,
$packageID);
db_query($q, $dbh);
}
# If a new category was chosen, change it to that
if ($_POST['category'] > 1) {
$q = sprintf( "UPDATE Packages SET CategoryID = %d WHERE ID = %d",
@ -366,7 +356,6 @@ if ($_COOKIE["AURSID"]):
# Update package depends
$depends = explode(" ", $new_pkgbuild['depends']);
foreach ($depends as $dep) {
$q = "INSERT INTO PackageDepends (PackageID, DepPkgID, DepCondition) VALUES (";
$deppkgname = preg_replace("/(<|<=|=|>=|>).*/", "", $dep);
$depcondition = str_replace($deppkgname, "", $dep);
@ -374,8 +363,10 @@ if ($_COOKIE["AURSID"]):
break;
}
$deppkgid = create_dummy($deppkgname, $_COOKIE['AURSID']);
$q .= $packageID . ", " . $deppkgid . ", '" . mysql_real_escape_string($depcondition) . "')";
$q = sprintf("INSERT INTO PackageDepends (PackageID, DepName, DepCondition) VALUES (%d, '%s', '%s')",
$packageID,
mysql_real_escape_string($deppkgname),
mysql_real_escape_string($depcondition));
db_query($q, $dbh);
}

View file

@ -31,7 +31,6 @@ $rss->image = $image;
#Get the latest packages and add items for them
$dbh = db_connect();
$q = "SELECT * FROM Packages ";
$q.= "WHERE DummyPkg != 1 ";
$q.= "ORDER BY SubmittedTS DESC ";
$q.= "LIMIT 0 , 20";
$result = db_query($q, $dbh);