""" % (sys.argv[0].replace("/data/project/rightstool/public_html//cgi-bin/", "").replace("py", ""), Quser, checked1, checked2)
#Do only if the user has been specified
if Quser!="":
totalcount = 0
print """
Recent log actions for %s
""" % Quser
#Getting the wiki list
db = MySQLdb.connect(db='meta_p', host="metawiki.labsdb", user=SQLuser, passwd=SQLpasswd)
cursor = db.cursor()
cursor.execute("SELECT dbname, slice, url FROM wiki WHERE url IS NOT NULL ORDER BY dbname")
wikis = cursor.fetchall()
dbhost = "";
#Getting the data from MySQL
for wiki in wikis:
try:
if wiki[1] != dbhost:
db.close()
dbhost = wiki[1]
db = MySQLdb.connect(host=dbhost, user=SQLuser, passwd=SQLpasswd)
cursor = db.cursor()
cursor.execute("USE %s_p;" % wiki[0])
if patr: hidepatrol = "log_type != 'patrol' and "
else: hidepatrol = ""
if nu: hidenu = "log_type != 'newusers' and "
else: hidenu = ""
sql = "select log_type, log_namespace, log_title, log_comment, log_timestamp from logging, user where %s%slog_user=user_id and user_name='%s' and log_type != 'suppress' order by log_timestamp desc limit 10;" % (hidepatrol, hidenu, Quser)
sqlc = "select count(*) from logging, user where log_user=user_id and user_name='%s';" % Quser
cursor.execute(sql)
result = cursor.fetchall()
results=result
cursor.execute(sqlc)
result = cursor.fetchall()
count = result[0][0]
results=()
except: results=()
if results!=():
print """
Total of %s log action(s)
""" % (wiki[2].replace("http://", "https://"), Quser, wiki[0], count)
totalcount += count
for i in results:
if int(i[1]) not in ns: namespace="Namespace_%s:" % i[1]
else: namespace=ns[int(i[1])]
if i[3]=='': comment=" "
else: comment=i[3].replace("<", "<").replace(">", ">")
t=i[4]
time="%s/%s/%s %s:%s:%s" % (t[:4], t[4:6], t[6:8], t[8:10], t[10:12], t[12:])
print """""" % (i[0], time, namespace, i[2], comment)
print """
Log type | Time | Title | Comment |
---|
%s | %s | %s%s | %s |
"""
print """
Total number of log actions: %s.
""" % totalcount
db.close()
print """