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>
This commit is contained in:
Dan McGee 2011-01-31 11:18:15 -06:00 committed by Lukas Fleischer
parent 492c8c668f
commit 7f5af61c88
11 changed files with 62 additions and 189 deletions

View file

@ -9,7 +9,8 @@ From 1.7.0 to 1.8.0
---- ----
ALTER TABLE Packages ADD OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL; ALTER TABLE Packages ADD OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL;
UPDATE Packages SET OutOfDateTS = UNIX_TIMESTAMP() WHERE OutOfDate = 1; UPDATE Packages SET OutOfDateTS = UNIX_TIMESTAMP() WHERE OutOfDate = 1;
ALTER TABLE Packages DROP OutOfDate, DROP URLPath; ALTER TABLE Packages DROP OutOfDate, DROP URLPath, DROP LocationID;
DROP TABLE PackageLocations;
---- ----
2. You will need to update all packages which are stored in the incoming dir as 2. You will need to update all packages which are stored in the incoming dir as

View file

@ -25,7 +25,7 @@ exec('ls ' . INCOMING_DIR, $files);
$count = 0; $count = 0;
foreach ($files as $pkgname) { foreach ($files as $pkgname) {
if (package_location($pkgname) != 'unsupported') { if (!package_exists($pkgname)) {
echo 'Removing ' . INCOMING_DIR . "$pkgname\n"; echo 'Removing ' . INCOMING_DIR . "$pkgname\n";
system('rm -r ' . INCOMING_DIR . $pkgname); system('rm -r ' . INCOMING_DIR . $pkgname);
$count++; $count++;

View file

@ -1,5 +1,5 @@
-- The MySQL database layout for the AUR. Certain data -- The MySQL database layout for the AUR. Certain data
-- is also included such as AccountTypes, PackageLocations, etc. -- is also included such as AccountTypes, etc.
-- --
DROP DATABASE AUR; DROP DATABASE AUR;
CREATE DATABASE AUR; CREATE DATABASE AUR;
@ -89,21 +89,6 @@ INSERT INTO PackageCategories (Category) VALUES ('x11');
INSERT INTO PackageCategories (Category) VALUES ('xfce'); INSERT INTO PackageCategories (Category) VALUES ('xfce');
-- The various repositories that a package could live in.
--
CREATE TABLE PackageLocations (
ID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
Location CHAR(32) NOT NULL,
PRIMARY KEY (ID)
);
INSERT INTO PackageLocations (Location) VALUES ('none');
INSERT INTO PackageLocations (Location) VALUES ('unsupported');
INSERT INTO PackageLocations (Location) VALUES ('community');
INSERT INTO PackageLocations (Location) VALUES ('current');
INSERT INTO PackageLocations (Location) VALUES ('extra');
INSERT INTO PackageLocations (Location) VALUES ('unstable');
-- Information about the actual packages -- Information about the actual packages
-- --
CREATE TABLE Packages ( CREATE TABLE Packages (
@ -116,7 +101,6 @@ CREATE TABLE Packages (
DummyPkg TINYINT UNSIGNED NOT NULL DEFAULT 0, -- 1=>dummy DummyPkg TINYINT UNSIGNED NOT NULL DEFAULT 0, -- 1=>dummy
FSPath CHAR(255) NOT NULL DEFAULT '', FSPath CHAR(255) NOT NULL DEFAULT '',
License CHAR(40) NOT NULL DEFAULT '', License CHAR(40) NOT NULL DEFAULT '',
LocationID TINYINT UNSIGNED NOT NULL DEFAULT 1,
NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0, NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0,
OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL, OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL,
SubmittedTS BIGINT UNSIGNED NOT NULL, SubmittedTS BIGINT UNSIGNED NOT NULL,
@ -127,13 +111,11 @@ CREATE TABLE Packages (
PRIMARY KEY (ID), PRIMARY KEY (ID),
UNIQUE (Name), UNIQUE (Name),
INDEX (CategoryID), INDEX (CategoryID),
INDEX (LocationID),
INDEX (DummyPkg), INDEX (DummyPkg),
INDEX (NumVotes), INDEX (NumVotes),
INDEX (SubmitterUID), INDEX (SubmitterUID),
INDEX (MaintainerUID), INDEX (MaintainerUID),
FOREIGN KEY (CategoryID) REFERENCES PackageCategories(ID) ON DELETE NO ACTION, FOREIGN KEY (CategoryID) REFERENCES PackageCategories(ID) ON DELETE NO ACTION,
FOREIGN KEY (LocationID) REFERENCES PackageLocations(ID) ON DELETE NO ACTION,
FOREIGN KEY (SubmitterUID) REFERENCES Users(ID) ON DELETE NO ACTION, FOREIGN KEY (SubmitterUID) REFERENCES Users(ID) ON DELETE NO ACTION,
FOREIGN KEY (MaintainerUID) REFERENCES Users(ID) ON DELETE NO ACTION FOREIGN KEY (MaintainerUID) REFERENCES Users(ID) ON DELETE NO ACTION
); );

View file

@ -85,28 +85,21 @@ esc = db.escape_string
# #
seen_users = {} seen_users = {}
seen_pkgs = {} seen_pkgs = {}
locations = {}
categories = {} categories = {}
location_keys = []
category_keys = [] category_keys = []
user_keys = [] user_keys = []
# some functions to generate random data # some functions to generate random data
# #
def genVersion(location_id=0): def genVersion():
ver = [] ver = []
ver.append("%d" % random.randrange(0,10)) ver.append("%d" % random.randrange(0,10))
ver.append("%d" % random.randrange(0,20)) ver.append("%d" % random.randrange(0,20))
if random.randrange(0,2) == 0: if random.randrange(0,2) == 0:
ver.append("%d" % random.randrange(0,100)) ver.append("%d" % random.randrange(0,100))
if location_id == 2: # the package is in the AUR
return ".".join(ver) + "-u%d" % random.randrange(1,11) return ".".join(ver) + "-u%d" % random.randrange(1,11)
else:
return ".".join(ver) + "%d" % random.randrange(1,11)
def genCategory(): def genCategory():
return categories[category_keys[random.randrange(0,len(category_keys))]] return categories[category_keys[random.randrange(0,len(category_keys))]]
def genLocation():
return locations[location_keys[random.randrange(0,len(location_keys))]]
def genUID(): def genUID():
return seen_users[user_keys[random.randrange(0,len(user_keys))]] return seen_users[user_keys[random.randrange(0,len(user_keys))]]
@ -162,7 +155,7 @@ contents = None
# Load package categories from database # Load package categories from database
# #
if DBUG: print "Loading package categories/locations..." if DBUG: print "Loading package categories..."
q = "SELECT * FROM PackageCategories" q = "SELECT * FROM PackageCategories"
dbc.execute(q) dbc.execute(q)
row = dbc.fetchone() row = dbc.fetchone()
@ -171,16 +164,6 @@ while row:
row = dbc.fetchone() row = dbc.fetchone()
category_keys = categories.keys() category_keys = categories.keys()
# Load package locations from database
#
q = "SELECT * FROM PackageLocations"
dbc.execute(q)
row = dbc.fetchone()
while row:
locations[row[1]] = row[0]
row = dbc.fetchone()
location_keys = locations.keys()
# done with the database # done with the database
# #
dbc.close() dbc.close()
@ -243,14 +226,10 @@ for p in seen_pkgs.keys():
if count % 20 == 0: # every so often, there are orphans... if count % 20 == 0: # every so often, there are orphans...
muid = 0 muid = 0
location_id = genLocation()
if location_id == 1: # unsupported pkgs don't have a maintainer
muid = 0
uuid = genUID() # the submitter/user uuid = genUID() # the submitter/user
s = "INSERT INTO Packages (ID, Name, Version, CategoryID, LocationID, SubmittedTS, SubmitterUID, MaintainerUID) VALUES (%d, '%s', '%s', %d, %d, %d, %d, %d);\n" % (seen_pkgs[p], p, genVersion(location_id), s = "INSERT INTO Packages (ID, Name, Version, CategoryID, SubmittedTS, SubmitterUID, MaintainerUID) VALUES (%d, '%s', '%s', %d, %d, %d, %d);\n" % (seen_pkgs[p], p, genVersion(),
genCategory(), location_id, NOW, uuid, muid) genCategory(), NOW, uuid, muid)
out.write(s) out.write(s)
if count % 100 == 0: if count % 100 == 0:
if DBUG: print ".", if DBUG: print ".",
@ -265,7 +244,6 @@ for p in seen_pkgs.keys():
s = "INSERT INTO PackageComments (PackageID, UsersID, Comments, CommentTS) VALUES (%d, %d, '%s', %d);\n" % (seen_pkgs[p], genUID(), fortune, now) s = "INSERT INTO PackageComments (PackageID, UsersID, Comments, CommentTS) VALUES (%d, %d, '%s', %d);\n" % (seen_pkgs[p], genUID(), fortune, now)
out.write(s) out.write(s)
if location_id == 1: # Unsupported - just a PKGBUILD and maybe other stuff
others = random.randrange(0,3) others = random.randrange(0,3)
s = "INSERT INTO PackageContents (PackageID, FSPath, FileSize) VALUES (%d, '%s', %d);\n" % (seen_pkgs[p], "/home/aur/incoming/%s/PKGBUILD" % p, s = "INSERT INTO PackageContents (PackageID, FSPath, FileSize) VALUES (%d, '%s', %d);\n" % (seen_pkgs[p], "/home/aur/incoming/%s/PKGBUILD" % p,
random.randrange(0,999)) random.randrange(0,999))
@ -294,34 +272,6 @@ for p in seen_pkgs.keys():
random.randrange(0,999)) random.randrange(0,999))
out.write(s) out.write(s)
else:
# Create package contents
#
num_files = random.randrange(PKG_FILES[0], PKG_FILES[1])
files = {}
for f in range(num_files):
loc = RANDOM_PATHS[random.randrange(len(RANDOM_PATHS))]
if "lib" in loc:
path = loc + "/lib" + p + ".so"
elif "man" in loc:
path = loc + "/" + p + "." + loc[-1] + ".gz"
elif "share" in loc:
path = loc + "/" + p + "/sounds/" + p + ".wav"
elif "profile" in loc:
path = loc + "/" + p + ".sh"
elif "rc.d" in loc:
path = loc + "/" + p
elif "etc" in loc:
path = loc + "/" + p + ".conf"
elif "opt" in loc:
path = loc + "/" + p + "/bin/" + p
else:
path = loc + "/" + p
if not files.has_key(path):
files[path] = 1
s = "INSERT INTO PackageContents (PackageID, FSPath, FileSize) VALUES (%d, '%s', %d);\n" % (seen_pkgs[p], path,
random.randrange(0,99999999))
out.write(s)
if DBUG: print "." if DBUG: print "."
# Cast votes # Cast votes

View file

@ -285,7 +285,7 @@ if ($_COOKIE["AURSID"]):
} }
# Update package data # 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['pkgname']),
mysql_real_escape_string($new_pkgbuild['pkgver']), mysql_real_escape_string($new_pkgbuild['pkgver']),
mysql_real_escape_string($new_pkgbuild['pkgrel']), mysql_real_escape_string($new_pkgbuild['pkgrel']),
@ -330,7 +330,7 @@ if ($_COOKIE["AURSID"]):
$uid = uid_from_sid($_COOKIE["AURSID"]); $uid = uid_from_sid($_COOKIE["AURSID"]);
# This is a brand new package # 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['pkgname']),
mysql_real_escape_string($new_pkgbuild['license']), mysql_real_escape_string($new_pkgbuild['license']),
mysql_real_escape_string($new_pkgbuild['pkgver']), mysql_real_escape_string($new_pkgbuild['pkgver']),
@ -406,7 +406,6 @@ html_header("Submit");
if (ini_get("file_uploads")): if (ini_get("file_uploads")):
$pkg_categories = pkgCategories(); $pkg_categories = pkgCategories();
$pkg_locations = pkgLocations();
?> ?>
<form action='pkgsubmit.php' method='post' enctype='multipart/form-data'> <form action='pkgsubmit.php' method='post' enctype='multipart/form-data'>

View file

@ -29,7 +29,7 @@ class AurJSON {
$this->fields = array( $this->fields = array(
'Packages.ID', 'Name', 'Version', 'CategoryID', 'Packages.ID', 'Name', 'Version', 'CategoryID',
'Description', 'LocationID', 'URL', 'CONCAT("' . 'Description', 'URL', 'CONCAT("' .
mysql_real_escape_string(URL_DIR) . mysql_real_escape_string(URL_DIR) .
'", Name, "/", Name, ".tar.gz") AS URLPath', 'License', '", Name, "/", Name, ".tar.gz") AS URLPath', 'License',
'NumVotes', '(OutOfDateTS IS NOT NULL) AS OutOfDate' 'NumVotes', '(OutOfDateTS IS NOT NULL) AS OutOfDate'

View file

@ -80,37 +80,6 @@ function pkgCategories() {
return $cats; 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 # check to see if the package name exists
# #
function package_exists($name="") { function package_exists($name="") {
@ -324,10 +293,9 @@ function package_details($id=0, $SID="") {
$atype = account_from_sid($SID); $atype = account_from_sid($SID);
$uid = uid_from_sid($SID); $uid = uid_from_sid($SID);
$q = "SELECT Packages.*,Location,Category "; $q = "SELECT Packages.*,Category ";
$q.= "FROM Packages,PackageLocations,PackageCategories "; $q.= "FROM Packages,PackageCategories ";
$q.= "WHERE Packages.LocationID = PackageLocations.ID "; $q.= "WHERE Packages.CategoryID = PackageCategories.ID ";
$q.= "AND Packages.CategoryID = PackageCategories.ID ";
$q.= "AND Packages.ID = " . intval($id); $q.= "AND Packages.ID = " . intval($id);
$dbh = db_connect(); $dbh = db_connect();
$results = db_query($q, $dbh); $results = db_query($q, $dbh);
@ -373,15 +341,13 @@ function package_details($id=0, $SID="") {
* request vars: * request vars:
* O - starting result number * O - starting result number
* PP - number of search hits per page * PP - number of search hits per page
* L - package location ID number
* C - package category ID number * C - package category ID number
* K - package search string * K - package search string
* SO - search hit sort order: * SO - search hit sort order:
* values: a - ascending * values: a - ascending
* d - descending * d - descending
* SB - sort search hits by: * SB - sort search hits by:
* values: l - package location * values: c - package category
* c - package category
* n - package name * n - package name
* v - number of votes * v - number of votes
* m - maintainer username * m - maintainer username
@ -415,8 +381,6 @@ function pkg_search_page($SID="") {
// grab info for user if they're logged in // grab info for user if they're logged in
if ($SID) if ($SID)
$myuid = uid_from_sid($SID); $myuid = uid_from_sid($SID);
// get a list of package locations
$locs = pkgLocations();
// get a list of package categories // get a list of package categories
$cats = pkgCategories(); //meow $cats = pkgCategories(); //meow
@ -455,7 +419,6 @@ function pkg_search_page($SID="") {
} }
$q .= "Users.Username AS Maintainer, $q .= "Users.Username AS Maintainer,
PackageCategories.Category, PackageCategories.Category,
PackageLocations.Location,
Packages.Name, Packages.Version, Packages.Description, Packages.NumVotes, Packages.Name, Packages.Version, Packages.Description, Packages.NumVotes,
Packages.ID, Packages.OutOfDateTS Packages.ID, Packages.OutOfDateTS
@ -469,15 +432,10 @@ function pkg_search_page($SID="") {
} }
$q .= "LEFT JOIN PackageCategories $q .= "LEFT JOIN PackageCategories
ON (Packages.CategoryID = PackageCategories.ID) ON (Packages.CategoryID = PackageCategories.ID)
LEFT JOIN PackageLocations
ON (Packages.LocationID = PackageLocations.ID)
WHERE Packages.DummyPkg = 0 "; WHERE Packages.DummyPkg = 0 ";
// TODO: possibly do string matching on category and // TODO: possibly do string matching on category
// location to make request variable values more sensible // to make request variable values more sensible
if (intval($_GET["L"])) {
$q .= "AND Packages.LocationID = ".intval($_GET["L"])." ";
}
if (intval($_GET["C"])) { if (intval($_GET["C"])) {
$q.= "AND Packages.CategoryID = ".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'; $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"]) { switch ($_GET["SB"]) {
case 'c': case 'c':
$q_sort = "ORDER BY CategoryID ".$order.", Name ASC, LocationID ASC "; $q_sort = "ORDER BY CategoryID ".$order.", Name ASC ";
$_GET["SB"] = 'c'; $_GET["SB"] = 'c';
break; break;
case 'l':
$q_sort = "ORDER BY LocationID ".$order.", Name ASC, CategoryID DESC ";
$_GET["SB"] = 'l';
break;
case 'v': case 'v':
$q_sort = "ORDER BY NumVotes ".$order.", Name ASC, CategoryID DESC "; $q_sort = "ORDER BY NumVotes ".$order.", Name ASC, CategoryID DESC ";
$_GET["SB"] = 'v'; $_GET["SB"] = 'v';
@ -542,11 +496,11 @@ function pkg_search_page($SID="") {
$_GET["SB"] = 'o'; $_GET["SB"] = 'o';
break; break;
case 'm': case 'm':
$q_sort = "ORDER BY Maintainer ".$order.", Name ASC, LocationID ASC "; $q_sort = "ORDER BY Maintainer ".$order.", Name ASC ";
$_GET["SB"] = 'm'; $_GET["SB"] = 'm';
break; break;
case 'a': 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'; $_GET["SB"] = 'a';
break; break;
default: default:
@ -719,10 +673,8 @@ function pkg_delete ($atype, $ids) {
# Only grab Unsupported packages that "we" own or are not owned at all # Only grab Unsupported packages that "we" own or are not owned at all
$ids_to_delete = array(); $ids_to_delete = array();
$q = "SELECT Packages.ID FROM Packages, PackageLocations "; $q = "SELECT Packages.ID FROM Packages ";
$q.= "WHERE Packages.ID IN (" . $delete . ") "; $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 they're a TU or dev, can delete
if ($atype == "Trusted User" || $atype == "Developer") { if ($atype == "Trusted User" || $atype == "Developer") {
@ -816,7 +768,6 @@ function pkg_adopt ($atype, $ids, $action = True) {
if ($action && $atype == "User") { if ($action && $atype == "User") {
# Regular users may only adopt orphan packages from unsupported # Regular users may only adopt orphan packages from unsupported
$q.= "AND $field = 0 "; $q.= "AND $field = 0 ";
$q.= "AND LocationID = 2 ";
} else if ($atype == "User") { } else if ($atype == "User") {
$q.= "AND $field = " . uid_from_sid($_COOKIE["AURSID"]); $q.= "AND $field = " . uid_from_sid($_COOKIE["AURSID"]);
} }
@ -1047,20 +998,18 @@ function pkg_change_category($atype) {
return __("Missing package ID."); return __("Missing package ID.");
} }
# Verify package ownership and location # Verify package ownership
$dbh = db_connect(); $dbh = db_connect();
$q = "SELECT Packages.MaintainerUID,"; $q = "SELECT Packages.MaintainerUID,";
$q.= "PackageLocations.Location ";
$q.= "FROM Packages "; $q.= "FROM Packages ";
$q.= "LEFT JOIN PackageLocations ON Packages.LocationID = PackageLocations.ID ";
$q.= "WHERE Packages.ID = ".$pid; $q.= "WHERE Packages.ID = ".$pid;
$result = db_query($q, $dbh); $result = db_query($q, $dbh);
echo mysql_error(); echo mysql_error();
$pkg = mysql_fetch_assoc($result); $pkg = mysql_fetch_assoc($result);
$uid = uid_from_sid($_COOKIE["AURSID"]); $uid = uid_from_sid($_COOKIE["AURSID"]);
if ($pkg["Location"] == "unsupported" and ($uid == $pkg["MaintainerUID"] or if ($uid == $pkg["MaintainerUID"] or
($atype == "Developer" or $atype == "Trusted User"))) { ($atype == "Developer" or $atype == "Trusted User")) {
$q = "UPDATE Packages "; $q = "UPDATE Packages ";
$q.= "SET CategoryID = ".intval($category_id)." "; $q.= "SET CategoryID = ".intval($category_id)." ";
$q.= "WHERE ID = ".intval($pid); $q.= "WHERE ID = ".intval($pid);

View file

@ -54,9 +54,9 @@ function user_table($user, $dbh)
{ {
global $apc_prefix; global $apc_prefix;
$escuser = mysql_real_escape_string($user); $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); $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 . "'"; $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; global $apc_prefix;
# AUR statistics # 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'); $unsupported_count = db_cache_value($q, $dbh, $apc_prefix . 'unsupported_count');
$q = "SELECT count(*) from Users"; $q = "SELECT count(*) from Users";

View file

@ -1,13 +1,13 @@
<?php <?php
$pkgid = intval($_REQUEST['ID']); $pkgid = intval($_REQUEST['ID']);
if ($row["Location"] == "unsupported" and ($uid == $row["MaintainerUID"] or if ($uid == $row["MaintainerUID"] or
($atype == "Developer" or $atype == "Trusted User"))) { ($atype == "Developer" or $atype == "Trusted User")) {
$catarr = pkgCategories(); $catarr = pkgCategories();
$edit_cat = "<form method='POST' action='packages.php?ID=".$pkgid."'>\n"; $edit_cat = "<form method='POST' action='packages.php?ID=".$pkgid."'>\n";
$edit_cat.= "<input type='hidden' name='action' value='do_ChangeCategory'>"; $edit_cat.= "<input type='hidden' name='action' value='do_ChangeCategory'>";
$edit_cat.= $row['Location']." :: "; $edit_cat.= "Category: ";
$edit_cat.= "<select name='category_id'>\n"; $edit_cat.= "<select name='category_id'>\n";
foreach ($catarr as $cid => $catname) { foreach ($catarr as $cid => $catname) {
$edit_cat.= "<option value='$cid'"; $edit_cat.= "<option value='$cid'";
@ -21,7 +21,7 @@ if ($row["Location"] == "unsupported" and ($uid == $row["MaintainerUID"] or
} }
else { else {
$edit_cat = $row['Location']." :: ".$row['Category']; $edit_cat = "Category: ".$row['Category'];
} }
if ($row["MaintainerUID"]) { if ($row["MaintainerUID"]) {
@ -76,11 +76,9 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[
<p><span class='f3'> <p><span class='f3'>
<?php <?php
if ($row['LocationID'] == 2) {
$urlpath = URL_DIR . $row['Name']; $urlpath = URL_DIR . $row['Name'];
print "<a href='$urlpath/" . $row['Name'] . ".tar.gz'>".__("Tarball")."</a> :: "; print "<a href='$urlpath/" . $row['Name'] . ".tar.gz'>".__("Tarball")."</a> :: ";
print "<a href='$urlpath/PKGBUILD'>".__("PKGBUILD")."</a></span>"; print "<a href='$urlpath/PKGBUILD'>".__("PKGBUILD")."</a></span>";
}
if ($row["OutOfDateTS"] !== NULL) { if ($row["OutOfDateTS"] !== NULL) {
echo "<br /><span class='f6'>".__("This package has been flagged out of date.")." (${out_of_date_time})</span>"; echo "<br /><span class='f6'>".__("This package has been flagged out of date.")." (${out_of_date_time})</span>";
@ -172,12 +170,10 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[
else { else {
$src = $src[0]; $src = $src[0];
# It is presumably an internal source # It is presumably an internal source
if ($row["LocationID"] == 2) {
echo "<span class='f8'>$src</span>"; echo "<span class='f8'>$src</span>";
echo "<br />\n"; echo "<br />\n";
} }
} }
}
?> ?>
</div> </div>
<?php <?php

View file

@ -56,7 +56,7 @@
<label><?php print __("Sort by"); ?></label> <label><?php print __("Sort by"); ?></label>
<select name='SB'> <select name='SB'>
<?php <?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): foreach ($sortby as $k => $v):
if ($_REQUEST['SB'] == $k): if ($_REQUEST['SB'] == $k):
?> ?>

View file

@ -15,9 +15,6 @@
<th style='border-bottom: #666 1px solid; vertical-align: bottom'>&nbsp;</th> <th style='border-bottom: #666 1px solid; vertical-align: bottom'>&nbsp;</th>
<?php endif; ?> <?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'> <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> <a href='?<?php print mkurl('SB=c&SO=' . $SO_next) ?>'><?php print __("Category") ?></a>
</span></th> </span></th>
@ -52,7 +49,6 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
<?php if ($SID): ?> <?php if ($SID): ?>
<td class='<?php print $c ?>'><input type='checkbox' name='IDs[<?php print $row["ID"] ?>]' value='1'></td> <td class='<?php print $c ?>'><input type='checkbox' name='IDs[<?php print $row["ID"] ?>]' value='1'></td>
<?php endif; ?> <?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='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 ?>'><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> <td class='<?php print $c ?>' style="text-align: right"><span class='f5'><span class='blue'><?php print $row["NumVotes"] ?></span></span></td>