summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-01-31 18:18:15 +0100
committerLukas Fleischer <archlinux@cryptocrack.de>2011-02-01 12:41:08 +0100
commit7f5af61c884b53a75a2b7f8b5146465f14a71f6b (patch)
tree52a959e9a9a7e940339906532a1f68a99595b4af /web
parent492c8c668f1edb708e49bcafbacb22c58e2877a5 (diff)
downloadaur-7f5af61c884b53a75a2b7f8b5146465f14a71f6b.tar.gz
aur-7f5af61c884b53a75a2b7f8b5146465f14a71f6b.tar.xz
Drop PackageLocations table and references
We don't need this anymore since all packages managed here are well...managed here. Rip out all of the places we were using this field, many of which depended on the magic value '2' anyway. On the display side of things, we had a column that was always showing 'unsupported' that is now gone, and you can no longer sort by this column. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web')
-rw-r--r--web/html/pkgsubmit.php5
-rw-r--r--web/lib/aurjson.class.php2
-rw-r--r--web/lib/pkgfuncs.inc79
-rw-r--r--web/lib/stats.inc6
-rw-r--r--web/template/pkg_details.php22
-rw-r--r--web/template/pkg_search_form.php2
-rw-r--r--web/template/pkg_search_results.php4
7 files changed, 30 insertions, 90 deletions
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index b15da3ff..bd233548 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -285,7 +285,7 @@ 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', LocationID = 2, FSPath = '%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', FSPath = '%s', OutOfDateTS = NULL WHERE ID = %d",
mysql_real_escape_string($new_pkgbuild['pkgname']),
mysql_real_escape_string($new_pkgbuild['pkgver']),
mysql_real_escape_string($new_pkgbuild['pkgrel']),
@@ -330,7 +330,7 @@ if ($_COOKIE["AURSID"]):
$uid = uid_from_sid($_COOKIE["AURSID"]);
# This is a brand new package
- $q = sprintf("INSERT INTO Packages (Name, License, Version, CategoryID, Description, URL, LocationID, SubmittedTS, SubmitterUID, MaintainerUID, FSPath) VALUES ('%s', '%s', '%s-%s', %d, '%s', '%s', 2, UNIX_TIMESTAMP(), %d, %d, '%s')",
+ $q = sprintf("INSERT INTO Packages (Name, License, Version, CategoryID, Description, URL, SubmittedTS, SubmitterUID, MaintainerUID, FSPath) VALUES ('%s', '%s', '%s-%s', %d, '%s', '%s', UNIX_TIMESTAMP(), %d, %d, '%s')",
mysql_real_escape_string($new_pkgbuild['pkgname']),
mysql_real_escape_string($new_pkgbuild['license']),
mysql_real_escape_string($new_pkgbuild['pkgver']),
@@ -406,7 +406,6 @@ html_header("Submit");
if (ini_get("file_uploads")):
$pkg_categories = pkgCategories();
- $pkg_locations = pkgLocations();
?>
<form action='pkgsubmit.php' method='post' enctype='multipart/form-data'>
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index d545ee0a..0c692811 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -29,7 +29,7 @@ class AurJSON {
$this->fields = array(
'Packages.ID', 'Name', 'Version', 'CategoryID',
- 'Description', 'LocationID', 'URL', 'CONCAT("' .
+ 'Description', 'URL', 'CONCAT("' .
mysql_real_escape_string(URL_DIR) .
'", Name, "/", Name, ".tar.gz") AS URLPath', 'License',
'NumVotes', '(OutOfDateTS IS NOT NULL) AS OutOfDate'
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index c701348d..997c4532 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -80,37 +80,6 @@ function pkgCategories() {
return $cats;
}
-# grab the current list of PackageLocations
-#
-function pkgLocations() {
- $locs = array();
- $dbh = db_connect();
- $q = "SELECT * FROM PackageLocations WHERE ID != 1 AND ID < 4 ";
- $q.= "ORDER BY Location ASC";
- $result = db_query($q, $dbh);
- if ($result) {
- while ($row = mysql_fetch_row($result)) {
- $locs[$row[0]] = $row[1];
- }
- }
- return $locs;
-}
-
-# Return the repository name for a particular package.
-function package_location($name="") {
- if (!$name) {return NULL;}
- $dbh = db_connect();
- $q = "SELECT PackageLocations.Location FROM Packages ";
- $q.= "LEFT JOIN PackageLocations ON ";
- $q.= "Packages.LocationID = PackageLocations.ID ";
- $q.= "WHERE Name = '".mysql_real_escape_string($name)."' ";
- $q.= "AND DummyPkg = 0";
- $result = db_query($q, $dbh);
- if (!$result) {return NULL;}
- $row = mysql_fetch_row($result);
- return $row[0];
-}
-
# check to see if the package name exists
#
function package_exists($name="") {
@@ -324,10 +293,9 @@ function package_details($id=0, $SID="") {
$atype = account_from_sid($SID);
$uid = uid_from_sid($SID);
- $q = "SELECT Packages.*,Location,Category ";
- $q.= "FROM Packages,PackageLocations,PackageCategories ";
- $q.= "WHERE Packages.LocationID = PackageLocations.ID ";
- $q.= "AND Packages.CategoryID = PackageCategories.ID ";
+ $q = "SELECT Packages.*,Category ";
+ $q.= "FROM Packages,PackageCategories ";
+ $q.= "WHERE Packages.CategoryID = PackageCategories.ID ";
$q.= "AND Packages.ID = " . intval($id);
$dbh = db_connect();
$results = db_query($q, $dbh);
@@ -373,15 +341,13 @@ function package_details($id=0, $SID="") {
* request vars:
* O - starting result number
* PP - number of search hits per page
- * L - package location ID number
* C - package category ID number
* K - package search string
* SO - search hit sort order:
* values: a - ascending
* d - descending
* SB - sort search hits by:
- * values: l - package location
- * c - package category
+ * values: c - package category
* n - package name
* v - number of votes
* m - maintainer username
@@ -415,8 +381,6 @@ function pkg_search_page($SID="") {
// grab info for user if they're logged in
if ($SID)
$myuid = uid_from_sid($SID);
- // get a list of package locations
- $locs = pkgLocations();
// get a list of package categories
$cats = pkgCategories(); //meow
@@ -455,7 +419,6 @@ function pkg_search_page($SID="") {
}
$q .= "Users.Username AS Maintainer,
PackageCategories.Category,
- PackageLocations.Location,
Packages.Name, Packages.Version, Packages.Description, Packages.NumVotes,
Packages.ID, Packages.OutOfDateTS
@@ -469,15 +432,10 @@ function pkg_search_page($SID="") {
}
$q .= "LEFT JOIN PackageCategories
ON (Packages.CategoryID = PackageCategories.ID)
- LEFT JOIN PackageLocations
- ON (Packages.LocationID = PackageLocations.ID)
WHERE Packages.DummyPkg = 0 ";
- // TODO: possibly do string matching on category and
- // location to make request variable values more sensible
- if (intval($_GET["L"])) {
- $q .= "AND Packages.LocationID = ".intval($_GET["L"])." ";
- }
+ // TODO: possibly do string matching on category
+ // to make request variable values more sensible
if (intval($_GET["C"])) {
$q.= "AND Packages.CategoryID = ".intval($_GET["C"])." ";
}
@@ -515,16 +473,12 @@ function pkg_search_page($SID="") {
$order = $_GET["SO"] == 'd' ? 'DESC' : 'ASC';
- $q_sort = "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC ";
+ $q_sort = "ORDER BY Name ".$order.", CategoryID DESC ";
switch ($_GET["SB"]) {
case 'c':
- $q_sort = "ORDER BY CategoryID ".$order.", Name ASC, LocationID ASC ";
+ $q_sort = "ORDER BY CategoryID ".$order.", Name ASC ";
$_GET["SB"] = 'c';
break;
- case 'l':
- $q_sort = "ORDER BY LocationID ".$order.", Name ASC, CategoryID DESC ";
- $_GET["SB"] = 'l';
- break;
case 'v':
$q_sort = "ORDER BY NumVotes ".$order.", Name ASC, CategoryID DESC ";
$_GET["SB"] = 'v';
@@ -542,11 +496,11 @@ function pkg_search_page($SID="") {
$_GET["SB"] = 'o';
break;
case 'm':
- $q_sort = "ORDER BY Maintainer ".$order.", Name ASC, LocationID ASC ";
+ $q_sort = "ORDER BY Maintainer ".$order.", Name ASC ";
$_GET["SB"] = 'm';
break;
case 'a':
- $q_sort = "ORDER BY GREATEST(SubmittedTS,ModifiedTS) ".$order.", Name ASC, LocationID ASC ";
+ $q_sort = "ORDER BY GREATEST(SubmittedTS,ModifiedTS) ".$order.", Name ASC ";
$_GET["SB"] = 'a';
break;
default:
@@ -719,10 +673,8 @@ function pkg_delete ($atype, $ids) {
# Only grab Unsupported packages that "we" own or are not owned at all
$ids_to_delete = array();
- $q = "SELECT Packages.ID FROM Packages, PackageLocations ";
+ $q = "SELECT Packages.ID FROM Packages ";
$q.= "WHERE Packages.ID IN (" . $delete . ") ";
- $q.= "AND Packages.LocationID = PackageLocations.ID ";
- $q.= "AND PackageLocations.Location = 'unsupported' ";
# If they're a TU or dev, can delete
if ($atype == "Trusted User" || $atype == "Developer") {
@@ -816,7 +768,6 @@ function pkg_adopt ($atype, $ids, $action = True) {
if ($action && $atype == "User") {
# Regular users may only adopt orphan packages from unsupported
$q.= "AND $field = 0 ";
- $q.= "AND LocationID = 2 ";
} else if ($atype == "User") {
$q.= "AND $field = " . uid_from_sid($_COOKIE["AURSID"]);
}
@@ -1047,20 +998,18 @@ function pkg_change_category($atype) {
return __("Missing package ID.");
}
- # Verify package ownership and location
+ # Verify package ownership
$dbh = db_connect();
$q = "SELECT Packages.MaintainerUID,";
- $q.= "PackageLocations.Location ";
$q.= "FROM Packages ";
- $q.= "LEFT JOIN PackageLocations ON Packages.LocationID = PackageLocations.ID ";
$q.= "WHERE Packages.ID = ".$pid;
$result = db_query($q, $dbh);
echo mysql_error();
$pkg = mysql_fetch_assoc($result);
$uid = uid_from_sid($_COOKIE["AURSID"]);
- if ($pkg["Location"] == "unsupported" and ($uid == $pkg["MaintainerUID"] or
- ($atype == "Developer" or $atype == "Trusted User"))) {
+ if ($uid == $pkg["MaintainerUID"] or
+ ($atype == "Developer" or $atype == "Trusted User")) {
$q = "UPDATE Packages ";
$q.= "SET CategoryID = ".intval($category_id)." ";
$q.= "WHERE ID = ".intval($pid);
diff --git a/web/lib/stats.inc b/web/lib/stats.inc
index 6a765581..f42e4177 100644
--- a/web/lib/stats.inc
+++ b/web/lib/stats.inc
@@ -54,9 +54,9 @@ function user_table($user, $dbh)
{
global $apc_prefix;
$escuser = mysql_real_escape_string($user);
- $base_q = "SELECT count(*) FROM Packages,PackageLocations,Users WHERE Packages.MaintainerUID = Users.ID AND Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = '%s' AND Users.Username='" . $escuser . "'";
+ $base_q = "SELECT count(*) FROM Packages,Users WHERE Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'";
- $maintainer_unsupported_count = db_cache_value(sprintf($base_q, 'unsupported'), $dbh,
+ $maintainer_unsupported_count = db_cache_value($base_q, $dbh,
$apc_prefix . 'user_unsupported_count:' . $escuser);
$q = "SELECT count(*) FROM Packages,Users WHERE Packages.OutOfDateTS IS NOT NULL AND Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'";
@@ -74,7 +74,7 @@ function general_stats_table($dbh)
{
global $apc_prefix;
# AUR statistics
- $q = "SELECT count(*) FROM Packages,PackageLocations WHERE Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = 'unsupported'";
+ $q = "SELECT count(*) FROM Packages WHERE DummyPkg = 0";
$unsupported_count = db_cache_value($q, $dbh, $apc_prefix . 'unsupported_count');
$q = "SELECT count(*) from Users";
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index 8aba3afa..c1c3e96f 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -1,13 +1,13 @@
<?php
$pkgid = intval($_REQUEST['ID']);
-if ($row["Location"] == "unsupported" and ($uid == $row["MaintainerUID"] or
- ($atype == "Developer" or $atype == "Trusted User"))) {
+if ($uid == $row["MaintainerUID"] or
+ ($atype == "Developer" or $atype == "Trusted User")) {
$catarr = pkgCategories();
$edit_cat = "<form method='POST' action='packages.php?ID=".$pkgid."'>\n";
$edit_cat.= "<input type='hidden' name='action' value='do_ChangeCategory'>";
- $edit_cat.= $row['Location']." :: ";
+ $edit_cat.= "Category: ";
$edit_cat.= "<select name='category_id'>\n";
foreach ($catarr as $cid => $catname) {
$edit_cat.= "<option value='$cid'";
@@ -21,7 +21,7 @@ if ($row["Location"] == "unsupported" and ($uid == $row["MaintainerUID"] or
}
else {
- $edit_cat = $row['Location']." :: ".$row['Category'];
+ $edit_cat = "Category: ".$row['Category'];
}
if ($row["MaintainerUID"]) {
@@ -76,11 +76,9 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[
<p><span class='f3'>
<?php
- if ($row['LocationID'] == 2) {
- $urlpath = URL_DIR . $row['Name'];
- print "<a href='$urlpath/" . $row['Name'] . ".tar.gz'>".__("Tarball")."</a> :: ";
- print "<a href='$urlpath/PKGBUILD'>".__("PKGBUILD")."</a></span>";
- }
+ $urlpath = URL_DIR . $row['Name'];
+ print "<a href='$urlpath/" . $row['Name'] . ".tar.gz'>".__("Tarball")."</a> :: ";
+ print "<a href='$urlpath/PKGBUILD'>".__("PKGBUILD")."</a></span>";
if ($row["OutOfDateTS"] !== NULL) {
echo "<br /><span class='f6'>".__("This package has been flagged out of date.")." (${out_of_date_time})</span>";
@@ -172,10 +170,8 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[
else {
$src = $src[0];
# It is presumably an internal source
- if ($row["LocationID"] == 2) {
- echo "<span class='f8'>$src</span>";
- echo "<br />\n";
- }
+ echo "<span class='f8'>$src</span>";
+ echo "<br />\n";
}
}
?>
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index c616c7b4..fdeb01b8 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -56,7 +56,7 @@
<label><?php print __("Sort by"); ?></label>
<select name='SB'>
<?php
- $sortby = array('n' => __('Name'), 'c' => __('Category'), 'l' => __('Location'), 'v' => __('Votes'), 'w' => __('Voted'), 'o' => __('Notify'), 'm' => __('Maintainer'), 'a' => __('Age'));
+ $sortby = array('n' => __('Name'), 'c' => __('Category'), 'v' => __('Votes'), 'w' => __('Voted'), 'o' => __('Notify'), 'm' => __('Maintainer'), 'a' => __('Age'));
foreach ($sortby as $k => $v):
if ($_REQUEST['SB'] == $k):
?>
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index b8f2e14b..4830ca85 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -16,9 +16,6 @@
<?php endif; ?>
<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
- <a href='?<?php print mkurl('SB=l&SO=' . $SO_next) ?>'><?php print __("Location") ?></a>
- </span></th>
- <th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
<a href='?<?php print mkurl('SB=c&SO=' . $SO_next) ?>'><?php print __("Category") ?></a>
</span></th>
<th style='border-bottom: #666 1px solid; vertical-align: bottom; text-align: center;'><span class='f2'>
@@ -52,7 +49,6 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
<?php if ($SID): ?>
<td class='<?php print $c ?>'><input type='checkbox' name='IDs[<?php print $row["ID"] ?>]' value='1'></td>
<?php endif; ?>
- <td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print $row["Location"] ?></span></span></td>
<td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print $row["Category"] ?></span></span></td>
<td class='<?php print $c ?>'><span class='f4'><a href='packages.php?ID=<?php print $row["ID"] ?>'><span class='black'><?php print $row["Name"] ?> <?php print $row["Version"] ?></span></a></span></td>
<td class='<?php print $c ?>' style="text-align: right"><span class='f5'><span class='blue'><?php print $row["NumVotes"] ?></span></span></td>