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
aae43d9a
Commit
aae43d9a
authored
Mar 05, 2005
by
eric
Browse files
started working on package comments
parent
93ac7cb9
Changes
5
Hide whitespace changes
Inline
Side-by-side
support/schema/aur-schema.sql
View file @
aae43d9a
...
...
@@ -180,13 +180,13 @@ CREATE TABLE PackageContents (
FOREIGN
KEY
(
PackageID
)
REFERENCES
Packages
(
ID
)
ON
DELETE
CASCADE
);
-- Record comments for
users submitting packages to AUR/unsupported
-- Record comments for
packages
--
CREATE
TABLE
Package
UploadHistory
(
CREATE
TABLE
Package
Comments
(
PackageID
INTEGER
UNSIGNED
NOT
NULL
,
UsersID
INTEGER
UNSIGNED
NOT
NULL
,
Comments
TEXT
NOT
NULl
DEFAULT
''
,
Upload
TS
BIGINT
UNSIGNED
NOT
NULL
DEFAULT
0
,
Comment
TS
BIGINT
UNSIGNED
NOT
NULL
DEFAULT
0
,
INDEX
(
UsersID
),
INDEX
(
PackageID
),
FOREIGN
KEY
(
UsersID
)
REFERENCES
Users
(
ID
)
ON
DELETE
CASCADE
,
...
...
support/schema/dummy-data.sql.bz2
View file @
aae43d9a
No preview for this file type
support/schema/gendummydata.py
View file @
aae43d9a
#!/usr/bin/python
"""
usage: gendummydata.py outputfilename.sql
"""
#
# This script seeds the AUR database with dummy data for
# use during development/testing. It uses random entries
...
...
@@ -22,16 +25,25 @@ MAX_PKGS = 2500 # how many packages to load
PKG_FILES
=
(
8
,
30
)
# min/max number of files in a package
PKG_DEPS
=
(
1
,
5
)
# min/max depends a package has
PKG_SRC
=
(
1
,
3
)
# min/max sources a package has
PKG_CMNTS
=
(
1
,
5
)
# min/max number of comments a package has
VOTING
=
(
0
,
.
30
)
# percentage range for package voting
RANDOM_PATHS
=
[
# random path locations for package files
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"
,
"/usr/man/man5"
,
"/usr/X11R6/man/man1"
,
"/etc/profile.d"
]
RANDOM_TLDS
=
[
"edu"
,
"com"
,
"org"
,
"net"
,
"tw"
,
"ru"
,
"pl"
,
"de"
,
"es"
]
RANDOM_URL
=
[
"http://www."
,
"ftp://ftp."
,
"http://"
,
"ftp://"
]
RANDOM_LOCS
=
[
"pub"
,
"release"
,
"files"
,
"downloads"
,
"src"
]
)
RANDOM_TLDS
=
(
"edu"
,
"com"
,
"org"
,
"net"
,
"tw"
,
"ru"
,
"pl"
,
"de"
,
"es"
)
RANDOM_URL
=
(
"http://www."
,
"ftp://ftp."
,
"http://"
,
"ftp://"
)
RANDOM_LOCS
=
(
"pub"
,
"release"
,
"files"
,
"downloads"
,
"src"
)
FORTUNE_FILES
=
(
"computers"
,
"fortunes"
,
"literature"
,
"science"
,
"songs-poems"
,
"startrek"
,
"wisdom"
,
"work"
,
"buffy"
,
"calvin"
,
"futurama"
,
"jargon"
,
"matrix"
,
"starwars"
,
"tao"
,
"chalkboard"
,
"dune"
,
"dune-messiah"
,
"children-of-dune"
,
"god-emperor"
,
"definitions"
,
"drugs"
,
"education"
,
"food"
,
"humorists"
,
"kids"
,
"law"
,
"news"
,
"people"
,
"pets"
,
"politics"
,
"platitudes"
,
"zippy"
,
"riddles"
)
FORTUNE_CMD
=
"/usr/bin/fortune -l "
+
" "
.
join
(
FORTUNE_FILES
)
import
random
...
...
@@ -39,6 +51,8 @@ import time
import
os
import
sys
import
cStringIO
import
commands
if
len
(
sys
.
argv
)
!=
2
:
sys
.
stderr
.
write
(
"Missing output filename argument"
);
...
...
@@ -71,6 +85,8 @@ except:
sys
.
stderr
.
write
(
"Could not connect to database
\n
"
);
raise
SystemExit
esc
=
db
.
escape_string
# track what users/package names have been used
#
...
...
@@ -226,6 +242,7 @@ if DBUG:
if
DBUG
:
print
"Creating SQL statements for packages."
,
count
=
0
for
p
in
seen_pkgs
.
keys
():
NOW
=
int
(
time
.
time
())
if
count
%
2
==
0
:
muid
=
developers
[
random
.
randrange
(
0
,
len
(
developers
))]
else
:
...
...
@@ -240,12 +257,21 @@ for p in seen_pkgs.keys():
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
)
genCategory
(),
location_id
,
NOW
,
uuid
,
uuid
,
muid
)
out
.
write
(
s
)
if
count
%
100
==
0
:
if
DBUG
:
print
"."
,
count
+=
1
# create random comments for this package
#
num_comments
=
random
.
randrange
(
PKG_CMNTS
[
0
],
PKG_CMNTS
[
1
])
for
i
in
range
(
0
,
num_comments
):
fortune
=
esc
(
commands
.
getoutput
(
FORTUNE_CMD
).
replace
(
"'"
,
""
).
replace
(
"
\n
"
,
" "
))
now
=
NOW
+
random
.
randrange
(
400
,
86400
*
3
)
s
=
"INSERT INTO PackageComments (PackageID, UsersID, Comments, CommentTS) VALUES (%d, %d, '%s', %d);
\n
"
%
(
seen_pkgs
[
p
],
uuid
,
fortune
,
now
)
out
.
write
(
s
)
if
location_id
==
1
:
# Unsupported - just a PKGBUILD and maybe other stuff
others
=
random
.
randrange
(
0
,
3
)
s
=
"INSERT INTO PackageContents (PackageID, URLPath, FSPath, FileSize) VALUES (%d, '%s', '%s', %d);
\n
"
%
(
seen_pkgs
[
p
],
"PKGBUILD"
,
"/home/aur/incoming/%s/PKGBUILD"
%
p
,
...
...
web/html/packages.php
View file @
aae43d9a
...
...
@@ -209,7 +209,7 @@ if (isset($_REQUEST["do_Flag"])) {
}
}
if
(
!
empty
(
$ids_to_delete
))
{
#
TODO
These are the packages that are safe to delete
# These are the packages that are safe to delete
#
foreach
(
$ids_to_delete
as
$id
)
{
# 1) delete from PackageVotes
...
...
@@ -228,8 +228,8 @@ if (isset($_REQUEST["do_Flag"])) {
$q
=
"DELETE FROM PackageSources WHERE PackageID = "
.
$id
;
$result
=
db_query
(
$q
,
$dbh
);
# 5) delete from Package
UploadHistory
$q
=
"DELETE FROM Package
UploadHistory
WHERE PackageID = "
.
$id
;
# 5) delete from Package
Comments
$q
=
"DELETE FROM Package
Comments
WHERE PackageID = "
.
$id
;
$result
=
db_query
(
$q
,
$dbh
);
# 6) delete from Packages
...
...
@@ -239,6 +239,7 @@ if (isset($_REQUEST["do_Flag"])) {
# TODO question: Now that the package as been deleted, does
# the unsupported repo need to be regenerated?
# ANSWER: No, there is no actual repo for unsupported, so no worries! (PJM)
# TODO question: What about regenerating the AUR repo? (EJ)
# Print the success message
print
"<p>
\n
"
;
...
...
@@ -355,6 +356,12 @@ if (isset($_REQUEST["do_Flag"])) {
$q
.
=
$vote_clauses
;
db_query
(
$q
,
$dbh
);
# Update the LastVoted field for this user
#
$q
=
"UPDATE Users SET LastVoted = UNIX_TIMESTAMP() "
;
$q
.
=
"WHERE ID = "
.
$uid
;
db_query
(
$q
,
$dbh
);
print
"<p>
\n
"
;
print
__
(
"Your votes have been cast for the selected packages."
);
print
"</p>
\n
"
;
...
...
web/html/pkgsubmit.php
View file @
aae43d9a
...
...
@@ -371,8 +371,8 @@ if ($_COOKIE["AURSID"]) {
# add upload history
#
$q
=
"INSERT INTO Package
UploadHistory
"
;
$q
.
=
"(PackageID, UsersID, Comments,
Upload
TS) VALUES ("
;
$q
=
"INSERT INTO Package
Comments
"
;
$q
.
=
"(PackageID, UsersID, Comments,
Comment
TS) VALUES ("
;
$q
.
=
$pdata
[
"ID"
]
.
", "
.
uid_from_sid
(
$_COOKIE
[
'AURSID'
]);
$q
.
=
", '"
.
mysql_escape_string
(
$_REQUEST
[
"comments"
]);
$q
.
=
"', UNIX_TIMESTAMP())"
;
...
...
@@ -434,8 +434,8 @@ if ($_COOKIE["AURSID"]) {
# add upload history
#
$q
=
"INSERT INTO Package
UploadHistory
"
;
$q
.
=
"(PackageID, UsersID, Comments,
Upload
TS) VALUES ("
;
$q
=
"INSERT INTO Package
Comments
"
;
$q
.
=
"(PackageID, UsersID, Comments,
Comment
TS) VALUES ("
;
$q
.
=
$packageID
.
", "
.
uid_from_sid
(
$_COOKIE
[
"AURSID"
])
.
", '"
;
$q
.
=
mysql_escape_string
(
$_REQUEST
[
"comments"
]);
$q
.
=
"', UNIX_TIMESTAMP())"
;
...
...
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