laufende änderungen

This commit is contained in:
Enno Rehling 2002-04-29 14:53:41 +00:00
parent 5ca815925a
commit 2a42b515b2
3 changed files with 22 additions and 16 deletions

View File

@ -22,7 +22,7 @@ locale="de"
smtpserver = 'localhost' smtpserver = 'localhost'
db=None db=None
game_id=0 # Eressea Main game game_id=0 # Eressea Main game
tutorial_id=None # 1 to active, None to disable tutorials tutorial_id=1 # 1 to active, None to disable tutorials
# define a new function called Display # define a new function called Display
# it takes one parameter - a string to Display # it takes one parameter - a string to Display

View File

@ -8,30 +8,36 @@
# * Will mark CONFIRMED users as WAITING, and send them another mail. # * Will mark CONFIRMED users as WAITING, and send them another mail.
import MySQLdb import MySQLdb
import string
import re import re
import sys import sys
import os
import smtplib import smtplib
dbname=sys.argv[1] dbname=sys.argv[1]
date=sys.argv[2] date=sys.argv[2]
db=MySQLdb.connect(db=dbname)
cursor=db.cursor()
From='accounts@eressea-pbem.de' From='accounts@eressea-pbem.de'
MailTemplate="templates/register.mail"
smtpserver='localhost' smtpserver='localhost'
server=smtplib.SMTP(smtpserver) server=smtplib.SMTP(smtpserver)
patchdir='/home/eressea/eressea-rsync' patchdir='/home/eressea/eressea-rsync'
game_id=0 game_id=0
db=MySQLdb.connect(db=dbname)
cursor=db.cursor()
cursor.execute("select name, patch from games where id="+str(game_id))
game, patch = cursor.fetchone()
MailTemplate="templates/register.mail."+string.lower(game)
def Patch(): def Patch():
i = cursor.execute("select name, patch from games where id="+str(game_id)) global patch
name, patch = cursor.fetchone()
print "Auswertung für " + name + " Patch Level " + str(int(patch)) + ", Runde "+str(lastturn) print "Auswertung für " + game + " Patch Level " + str(int(patch))
while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK): while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK):
patch=patch+1 patch=patch+1
print " Patching to level "+str(patch) print " Patching to level "+str(patch)
os.system('mysql ' + dbname + ' < ' + patchdir+'/patch-'+str(int(patch))+'.sql') os.system('mysql ' + dbname + ' < ' + patchdir+'/patch-'+str(int(patch))+'.sql')
cursor.execute('update games set patch='+str(int(patch))+' where id='+str(gid)) cursor.execute('update games set patch='+str(int(patch))+' where id='+str(game_id))
return return
def Send(email, custid, firstname, password, position, locale): def Send(email, custid, firstname, password, position, locale):
@ -51,11 +57,9 @@ def Send(email, custid, firstname, password, position, locale):
return return
Patch() Patch()
print "must update this. only partially done"
sys.exit(-1)
# remove all illegal and banned users: # remove all illegal and banned users:
users = cursor.execute("SELECT s.id from users u, subscriptions s where u.id=s.user and u.status in ('BANNED', 'ILLEGAL')") users = cursor.execute("SELECT s.id from users u, subscriptions s where u.id=s.user and u.status in ('BANNED', 'ILLEGAL')")
update=db.cursor()
while users: while users:
users=users-1 users=users-1
sid = cursor.fetchone()[0] sid = cursor.fetchone()[0]
@ -66,12 +70,14 @@ cursor.execute("update subscriptions set status='EXPIRED' where TO_DAYS(updated)
cursor.execute("update subscriptions set status='WAITING' where TO_DAYS(updated)<TO_DAYS('"+date+"') and status='CONFIRMED'") cursor.execute("update subscriptions set status='WAITING' where TO_DAYS(updated)<TO_DAYS('"+date+"') and status='CONFIRMED'")
# remind everyone who is left on the waiting list. # remind everyone who is left on the waiting list.
waiting = cursor.execute("select firstname, locale, email, u.id, s.password from users u, subscriptions s where u.id=s.users and s.status='WAITING'") waiting = cursor.execute("select firstname, locale, email, u.id, s.password, u.password from users u, subscriptions s where u.id=s.user and s.status='WAITING'")
position=0 position=0
while waiting: while waiting:
waiting=waiting-1 waiting=waiting-1
position=position+1 position=position+1
firstname, locale, email, custid, password = cursor.fetchone() firstname, locale, email, custid, password, altpass = cursor.fetchone()
if password==None:
password=altpass
print "Sending reminder email to "+str(int(custid))+" "+email print "Sending reminder email to "+str(int(custid))+" "+email
Send(email, custid, firstname, password, position, locale) Send(email, custid, firstname, password, position, locale)

View File

@ -13,9 +13,9 @@ warnahead=4
cancelafter=1 cancelafter=1
db=MySQLdb.connect(db=dbname) db=MySQLdb.connect(db=dbname)
cursor=db.cursor() cursor=db.cursor()
users = cursor.execute("select users.email, users.id, count(subscriptions.game) from users, subscriptions, games where users.id=subscriptions.user and subscriptions.game=games.id and users.id!=0 and games.status='RUNNING' GROUP BY users.id")
server=smtplib.SMTP('localhost') server=smtplib.SMTP('localhost')
print "connected to SMTP"
users = cursor.execute("select users.email, users.id, count(subscriptions.game) from users, subscriptions, games where users.id=subscriptions.user and subscriptions.game=games.id and users.id!=0 and games.status='RUNNING' GROUP BY users.id")
while users > 0: while users > 0:
users=users-1 users=users-1
email, uid, games = cursor.fetchone() email, uid, games = cursor.fetchone()