From 04150b17b20babe93e99d6e961da76ef6723a0b1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 24 Mar 2002 14:29:35 +0000 Subject: [PATCH] resetting the waitinglist --- scripts/register/update.py | 29 ------------------- scripts/register/wait-reset.py | 53 ++++++++++++++++++++++++++++++++++ scripts/register/warn.py | 2 +- 3 files changed, 54 insertions(+), 30 deletions(-) delete mode 100644 scripts/register/update.py create mode 100755 scripts/register/wait-reset.py diff --git a/scripts/register/update.py b/scripts/register/update.py deleted file mode 100644 index e6de4f01d..000000000 --- a/scripts/register/update.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -import MySQLdb -import re -import sys - -dbname=sys.argv[1] -file=sys.argv[2] -game=int(sys.argv[3]) -infile=open(file, 'r') -db=MySQLdb.connect(db=dbname) -cursor=db.cursor() - -matchrenum=re.compile( - r"""\brenum\s([^\s]+)\s(.*)\n""", - re.IGNORECASE | re.DOTALL | re.VERBOSE) - -matchdropout=re.compile( - r"""dropout\s(.*)""", - re.IGNORECASE | re.DOTALL | re.VERBOSE) - -for line in infile.readlines(): - match=matchrenum.match(line) - if match!=None: - fold=match.group(1) - fnew=match.group(2) - i=cursor.execute("update subscriptions set faction='"+fnew+"' where game="+str(game)+" and faction='"+fold+"'") - if i!=1: - print "could not renum faction "+fold+" to new id "+fnew diff --git a/scripts/register/wait-reset.py b/scripts/register/wait-reset.py new file mode 100755 index 000000000..0bdb7615b --- /dev/null +++ b/scripts/register/wait-reset.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# +# reset the waiting list after ZAT. +# before running this script, be sure to apply the patchfile generated by the eressea-server to +# mark users with new accounts as ACTIVE. +# * Will mark WAITING users as EXPIRED, removig them from the waitng list. +# * Will mark CONFIRMED users as WAITING, and send them another mail. + +import MySQLdb +import re +import sys +import smtplib + +dbname=sys.argv[1] +date=sys.argv[2] +db=MySQLdb.connect(db=dbname) +From='accounts@eressea-pbem.de' +cursor=db.cursor() +MailTemplate="templates/register.mail" +smtpserver='localhost' +server=smtplib.SMTP(smtpserver) + +def Send(email, custid, firstname, password, position, locale): + TemplateHandle = open(MailTemplate+"."+locale, "r") # open in read only mode + # read the entire file as a string + TemplateInput = TemplateHandle.read() + TemplateHandle.close() # close the file + + SubResult = re.subn("", firstname, TemplateInput) + SubResult = re.subn("", password, SubResult[0]) + SubResult = re.subn("", str(int(position)), SubResult[0]) + SubResult = re.subn("", str(int(custid)), SubResult[0]) + + Msg="From: "+From+"\nTo: "+email+"\nSubject: Eressea Anmeldung\n\n" + Msg=Msg+SubResult[0] + server.sendmail(From, email, Msg) + return + +cursor.execute("update users set status='EXPIRED' where TO_DAYS(updated) 0: users=users-1