7 docroot
= os
.path
.dirname(os
.path
.realpath(__file__
)) + "/../web/html/"
9 config
= configparser
.RawConfigParser()
10 config
.read(os
.path
.dirname(os
.path
.realpath(__file__
)) + "/../conf/config")
12 aur_db_host
= config
.get('database', 'host')
13 aur_db_name
= config
.get('database', 'name')
14 aur_db_user
= config
.get('database', 'user')
15 aur_db_pass
= config
.get('database', 'password')
16 aur_db_socket
= config
.get('database', 'socket')
18 db
= mysql
.connector
.connect(host
=aur_db_host
, user
=aur_db_user
,
19 passwd
=aur_db_pass
, db
=aur_db_name
,
20 unix_socket
=aur_db_socket
, buffered
=True)
23 cur
.execute("UPDATE PackageBases SET NumVotes = (SELECT COUNT(*) FROM " +
24 "PackageVotes WHERE PackageVotes.PackageBaseID = PackageBases.ID)")
26 cur
.execute("UPDATE PackageBases SET Popularity = (" +
27 "SELECT SUM(POWER(0.98, (UNIX_TIMESTAMP() - VoteTS) / 86400)) " +
28 "FROM PackageVotes WHERE PackageVotes.PackageBaseID = " +
29 "PackageBases.ID AND NOT VoteTS IS NULL)")