Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Kristian Klausen
aurweb
Commits
761ddc3d
Commit
761ddc3d
authored
Jun 29, 2004
by
eric
Browse files
yet another schema change
parent
6249c40e
Changes
5
Hide whitespace changes
Inline
Side-by-side
support/schema/aur-schema.sql
View file @
761ddc3d
...
...
@@ -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
);
...
...
support/schema/dummy-data.sql.bz2
0 → 100644
View file @
761ddc3d
File added
support/schema/dummy-data.sql.gz
deleted
100644 → 0
View file @
6249c40e
File deleted
support/schema/gendummydata.py
View file @
761ddc3d
...
...
@@ -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
"."
,
...
...
web/lib/pkgfuncs.inc
View file @
761ddc3d
...
...
@@ -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
"<form action='/pkgsearch.php' method='post'>
\n
"
;
print
"<input type='hidden' name='O' value='"
.
$O
.
"'>
\n
"
;
print
"<input type='hidden' name='L' value='"
.
$_REQUEST
[
"L"
]
.
"'>
\n
"
;
print
"<input type='hidden' name='M' value='"
.
$_REQUEST
[
"M"
]
.
"'>
\n
"
;
print
"<input type='hidden' name='C' value='"
.
$_REQUEST
[
"C"
]
.
"'>
\n
"
;
print
"<input type='hidden' name='K' value='"
.
$K
.
"'>
\n
"
;
print
"<input type='hidden' name='SB' value='"
.
$_REQUEST
[
"SB"
]
.
"'>
\n
"
;
print
"<input type='hidden' name='PP' value='"
.
$PP
.
"'>
\n
"
;
print
"<center>
\n
"
;
print
"<table cellspacing='3' class='boxSoft'>
\n
"
;
...
...
@@ -105,7 +97,7 @@ function pkg_search_page($SID="") {
print
" <select name='L'>
\n
"
;
print
" <option value=0> "
.
__
(
"Any"
)
.
"
\n
"
;
while
(
list
(
$id
,
$loc
)
=
each
(
$locs
))
{
if
(
$_REQUEST
[
"L"
]
==
$id
)
{
if
(
intval
(
$_REQUEST
[
"L"
]
)
==
$id
)
{
print
" <option value="
.
$id
.
" selected> "
.
$loc
.
"
\n
"
;
}
else
{
print
" <option value="
.
$id
.
"> "
.
$loc
.
"
\n
"
;
...
...
@@ -120,7 +112,7 @@ function pkg_search_page($SID="") {
print
" <select name='C'>
\n
"
;
print
" <option value=0> "
.
__
(
"Any"
)
.
"
\n
"
;
while
(
list
(
$id
,
$cat
)
=
each
(
$cats
))
{
if
(
$_REQUEST
[
"C"
]
==
$id
)
{
if
(
intval
(
$_REQUEST
[
"C"
]
)
==
$id
)
{
print
" <option value="
.
$id
.
" selected> "
.
$cat
.
"
\n
"
;
}
else
{
print
" <option value="
.
$id
.
"> "
.
$cat
.
"
\n
"
;
...
...
@@ -133,6 +125,8 @@ function pkg_search_page($SID="") {
print
" <span class='f5'><span class='blue'>"
.
__
(
"Keywords"
);
print
"</span></span><br />
\n
"
;
print
" <input type='text' name='K' size='35'"
;
$K
=
str_replace
(
"
\"
"
,
""
,
$_REQUEST
[
"K"
]);
# TODO better testing for
# SQL trickery...
print
" value=
\"
"
.
stripslashes
(
$K
)
.
"
\"
maxlength='35'>
\n
"
;
print
"</td>
\n
"
;
...
...
@@ -198,16 +192,16 @@ function pkg_search_page($SID="") {
# $q.= "ON Packages.ID = PackageVotes.PackageID ";
$q
=
"SELECT * FROM Packages "
;
$has_where
=
0
;
if
(
isset
(
$_REQUEST
[
"L"
])
&&
$_REQUEST
[
"L"
])
{
$q
.
=
"WHERE LocationID = "
.
mysql_escape_string
(
$_REQUEST
[
"L"
])
.
" "
;
if
(
isset
(
$_REQUEST
[
"L"
])
&&
intval
(
$_REQUEST
[
"L"
])
)
{
$q
.
=
"WHERE LocationID = "
.
intval
(
$_REQUEST
[
"L"
])
.
" "
;
$has_where
=
1
;
}
if
(
isset
(
$_REQUEST
[
"C"
])
&&
$_REQUEST
[
"C"
])
{
if
(
isset
(
$_REQUEST
[
"C"
])
&&
intval
(
$_REQUEST
[
"C"
])
)
{
if
(
!
$has_where
)
{
$q
.
=
"WHERE CategoryID = "
.
mysql_escape_string
(
$_REQUEST
[
"C"
])
.
" "
;
$q
.
=
"WHERE CategoryID = "
.
intval
(
$_REQUEST
[
"C"
])
.
" "
;
$has_where
=
1
;
}
else
{
$q
.
=
"AND CategoryID = "
.
mysql_escape_string
(
$_REQUEST
[
"C"
])
.
" "
;
$q
.
=
"AND CategoryID = "
.
intval
(
$_REQUEST
[
"C"
])
.
" "
;
}
}
if
(
$K
)
{
...
...
@@ -220,7 +214,7 @@ function pkg_search_page($SID="") {
$q
.
=
"Description LIKE '%"
.
mysql_escape_string
(
$K
)
.
"%') "
;
}
}
if
(
isset
(
$_REQUEST
[
"
M"
])
&&
$_REQUEST
[
"M
"
]
&&
$SID
)
{
if
(
isset
(
$_REQUEST
[
"
do_MyPackages
"
]
)
&&
$SID
)
{
if
(
$myuid
)
{
if
(
!
$has_where
)
{
$q
.
=
"WHERE MaintainerUID = "
.
$myuid
.
" "
;
...
...
@@ -231,22 +225,21 @@ function pkg_search_page($SID="") {
}
}
switch
(
isset
(
$_REQUEST
[
"SB"
])
)
{
switch
(
$_REQUEST
[
"SB"
])
{
case
'c'
:
$q
.
=
"ORDER BY CategoryID
A
SC, Name ASC, LocationID ASC "
;
$q
.
=
"ORDER BY CategoryID
DE
SC, Name ASC, LocationID ASC "
;
break
;
case
'l'
:
$q
.
=
"ORDER BY LocationID ASC, Name ASC, CategoryID
A
SC "
;
$q
.
=
"ORDER BY LocationID ASC, Name ASC, CategoryID
DE
SC "
;
break
;
case
'v'
:
$q
.
=
"ORDER BY NumVotes DESC, Name ASC, CategoryID
A
SC "
;
$q
.
=
"ORDER BY NumVotes DESC, Name ASC, CategoryID
DE
SC "
;
break
;
default
:
$q
.
=
"ORDER BY Name ASC, LocationID ASC, CategoryID
A
SC "
;
$q
.
=
"ORDER BY Name ASC, LocationID ASC, CategoryID
DE
SC "
;
break
;
}
$q
.
=
"LIMIT "
.
$O
.
", "
.
$PP
;
print
$q
.
"<br />
\n
"
;
$result
=
db_query
(
$q
,
$dbh
);
...
...
@@ -257,13 +250,10 @@ function pkg_search_page($SID="") {
print
__
(
"No packages matched your search criteria."
);
}
else
{
# TODO need an "action" table in here like on /devel? It would
# allow the visitor to flag packages out-of-date, vote, adopt/disown?
# Probably need to think about the overall UI of this - the package
# name will be a link that goes to 'details'. There should also be
# a column for 'manage/edit'
if
(
$SID
)
{
# The 'Actions' table
#
print
"<center>
\n
"
;
print
"<table cellspacing='3' class='boxSoft'>
\n
"
;
print
"<tr>
\n
"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment