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