From 761ddc3ddcaeb46f48fc746ad2f3cedb97cb1249 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 29 Jun 2004 21:22:31 +0000 Subject: yet another schema change --- support/schema/aur-schema.sql | 9 ++++-- support/schema/dummy-data.sql.bz2 | Bin 0 -> 687869 bytes support/schema/dummy-data.sql.gz | Bin 77962 -> 0 bytes support/schema/gendummydata.py | 24 ++++++++------- web/lib/pkgfuncs.inc | 60 ++++++++++++++++---------------------- 5 files changed, 44 insertions(+), 49 deletions(-) create mode 100644 support/schema/dummy-data.sql.bz2 delete mode 100644 support/schema/dummy-data.sql.gz diff --git a/support/schema/aur-schema.sql b/support/schema/aur-schema.sql index 876cf285..dd023109 100644 --- a/support/schema/aur-schema.sql +++ b/support/schema/aur-schema.sql @@ -113,8 +113,9 @@ CREATE TABLE Packages ( NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0, OutOfDate TINYINT UNSIGNED DEFAULT 0, SubmittedTS BIGINT UNSIGNED NOT NULL, - SubmitterUID INTEGER UNSIGNED NOT NULL DEFAULT 0, - MaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, + SubmitterUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- who submitted it? + MaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- User + AURMaintainerUID INTEGER UNSIGNED NOT NULL DEFAULT 0, -- TU/Dev PRIMARY KEY (ID), UNIQUE (Name), INDEX (CategoryID), @@ -123,10 +124,12 @@ CREATE TABLE Packages ( INDEX (NumVotes), INDEX (SubmitterUID), INDEX (MaintainerUID), + INDEX (AURMaintainerUID), 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 (MaintainerUID) REFERENCES Users(ID) ON DELETE NO ACTION + FOREIGN KEY (MaintainerUID) REFERENCES Users(ID) ON DELETE NO ACTION, + FOREIGN KEY (AURMaintainerUID) REFERENCES Users(ID) ON DELETE NO ACTION ); diff --git a/support/schema/dummy-data.sql.bz2 b/support/schema/dummy-data.sql.bz2 new file mode 100644 index 00000000..1b5bde38 Binary files /dev/null and b/support/schema/dummy-data.sql.bz2 differ diff --git a/support/schema/dummy-data.sql.gz b/support/schema/dummy-data.sql.gz deleted file mode 100644 index 296b8aa1..00000000 Binary files a/support/schema/dummy-data.sql.gz and /dev/null differ diff --git a/support/schema/gendummydata.py b/support/schema/gendummydata.py index 7365296e..917b569f 100755 --- a/support/schema/gendummydata.py +++ b/support/schema/gendummydata.py @@ -13,15 +13,15 @@ DB_HOST = "localhost" DB_NAME = "AUR" DB_USER = "aur" DB_PASS = "aur" -USER_ID = 5 # Users.ID of first user -PKG_ID = 1 # Packages.ID of first package -MAX_USERS = 1000 # how many users to 'register' -MAX_DEVS = .1 # what percentage of MAX_USERS are Developers -MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users -MAX_PKGS = 2500 # how many packages to load -PKG_FILES = (8, 30) # min/max number of files in a package -VOTING = (.1, .4) # percentage range for package voting -RANDOM_PATHS = [ # random path locations for package files +USER_ID = 5 # Users.ID of first user +PKG_ID = 1 # Packages.ID of first package +MAX_USERS = 500 # how many users to 'register' +MAX_DEVS = .1 # what percentage of MAX_USERS are Developers +MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users +MAX_PKGS = 2500 # how many packages to load +PKG_FILES = (8, 30) # min/max number of files in a package +VOTING = (0, .30) # percentage range for package voting +RANDOM_PATHS = [ # random path locations for package files "/usr/bin", "/usr/lib", "/etc", "/etc/rc.d", "/usr/share", "/lib", "/var/spool", "/var/log", "/usr/sbin", "/opt", "/usr/X11R6/bin", "/usr/X11R6/lib", "/usr/libexec", "/usr/man/man1", "/usr/man/man3", @@ -225,8 +225,10 @@ for p in seen_pkgs.keys(): if location_id == 1: # unsupported pkgs don't have a maintainer muid = 0 - 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), genCategory(), - location_id, long(time.time()), genUID(), muid) + uuid = genUID() # the submitter/user + + s = "INSERT INTO Packages (ID, Name, Version, CategoryID, LocationID, SubmittedTS, SubmitterUID, MaintainerUID, AURMaintainerUID) VALUES (%d, '%s', '%s', %d, %d, %d, %d, %d, %d);\n" % (seen_pkgs[p], p, genVersion(location_id), + genCategory(), location_id, long(time.time()), uuid, uuid, muid) out.write(s) if count % 100 == 0: if DBUG: print ".", diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index c8427ab8..2b6dd2be 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -38,14 +38,7 @@ function pkgLocations() { function pkg_search_page($SID="") { global $_REQUEST; # SID: session id cookie - # L: PackageLocations.ID - # C: PackageCategories.ID - # K: Keywords - # SB: Sort by - # M: search "my packages" - # O: Row offset - # PP: Per page - # D: Direction to advance (Less/More) + $locs = pkgLocations(); $cats = pkgCategories(); $devs = getDevelopers(); @@ -56,6 +49,8 @@ function pkg_search_page($SID="") { # determine paging variables # isset($_REQUEST["PP"]) ? $PP = intval($_REQUEST["PP"]) : $PP = 25; + if ($PP < 25) {$PP = 25;} + if ($PP > 100) {$PP = 100;} isset($_REQUEST["O"]) ? $O = intval($_REQUEST["O"]) : $O = 0; if (isset($_REQUEST["do_More"])) { $O += $PP; @@ -65,6 +60,11 @@ function pkg_search_page($SID="") { if ($O < 0) { $O = 0; } + if (isset($_REQUEST["do_Search"]) || isset($_REQUEST["do_MyPackages"])) { + # reset the offset to zero if they hit Go/My Packages + # + $O = 0; + } # grab info for user if they're logged in @@ -76,16 +76,8 @@ function pkg_search_page($SID="") { # The search form # - $K = str_replace("\"", "", $_REQUEST["K"]); # TODO better testing for - # SQL trickery... print "
\n"; print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; print "
\n"; print "\n"; @@ -105,7 +97,7 @@ function pkg_search_page($SID="") { print " \n"; print "
\n"; print "\n"; -- cgit v1.2.3-24-g4f1b