forked from github/server
zat-skript fixes
This commit is contained in:
parent
d1e574877a
commit
dcb6b789d6
|
@ -130,8 +130,8 @@ else:
|
|||
cursor.execute("INSERT INTO users (firstname, lastname, email, address, city, phone, country, password) "+
|
||||
"VALUES ('"+firstname+"', '"+lastname+"', '"+email+"', '"+address+"', '"+city+"', '"+phone+"', "+country+", '"+genpasswd()+"')")
|
||||
|
||||
cursor.execute("SELECT LAST_INSERT_ID() from dual")
|
||||
userid=str(int(cursor.fetchone()[0]))
|
||||
cursor.execute("SELECT LAST_INSERT_ID() from dual")
|
||||
userid=str(int(cursor.fetchone()[0]))
|
||||
|
||||
cursor.execute("INSERT INTO subscriptions (user, game, status) "+
|
||||
"VALUES ("+str(userid)+", 3, 'WAITING')")
|
||||
|
|
|
@ -5,6 +5,9 @@ import smtplib
|
|||
|
||||
From='accounts@vinyambar.de'
|
||||
dbname=sys.argv[1]
|
||||
dryrun=0
|
||||
if len(sys.argv)>2:
|
||||
dryrun=1
|
||||
price=1.25
|
||||
warnahead=2
|
||||
db=MySQLdb.connect(db=dbname)
|
||||
|
@ -35,7 +38,8 @@ while users > 0:
|
|||
"BLZ 500 502 01 (Frankfurter Sparkasse)\n")
|
||||
try:
|
||||
# print Msg
|
||||
server.sendmail(From, email, Msg)
|
||||
if dryrun==0:
|
||||
server.sendmail(From, email, Msg)
|
||||
except:
|
||||
print "Could not send confirmation to "+email
|
||||
print "Exception is:", sys.exc_type, ":", sys.exc_value
|
||||
|
|
|
@ -17,26 +17,30 @@ if k==0:
|
|||
print "Unbekanntes Spiel"
|
||||
|
||||
name, patch = cursor.fetchone()
|
||||
print "Auswertung für " + name + " Patch Level " + str(int(patch))
|
||||
while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK)==0:
|
||||
patch=patch+1
|
||||
os.system('mysql --table ' + dbname + '-e ' + patchdir+'/patch-'+str(int(patch+1))+'.sql')
|
||||
cursor.execute('update games set patch='+str(int(patch))+' where game='+str(game))
|
||||
|
||||
k = cursor.execute("UPDATE subscriptions SET user=NULL where status='TRANSFERED' and updated<'"+date+"'"
|
||||
os.system("mysqldump vinyambar > backup-vinyambar-"+str(int(patch))+".sql")
|
||||
|
||||
k = cursor.execute("SELECT max(lastturn) from subscriptions")
|
||||
lastturn = int(cursor.fetchone()[0])
|
||||
|
||||
print "Auswertung für " + name + " Patch Level " + str(int(patch)) + ", Runde "+str(lastturn)
|
||||
while os.access(patchdir+'/patch-'+str(int(patch+1))+'.sql', os.F_OK):
|
||||
patch=patch+1
|
||||
print " Patching to level "+str(patch)
|
||||
os.system('mysql ' + dbname + ' < ' + patchdir+'/patch-'+str(int(patch))+'.sql')
|
||||
cursor.execute('update games set patch='+str(int(patch))+' where id='+str(game))
|
||||
|
||||
k = cursor.execute("UPDATE subscriptions SET user=0 where game="+str(int(game))+" and status='TRANSFERED' and updated<'"+date+"'")
|
||||
print "Removing "+str(int(k))+" transfered subscriptions."
|
||||
|
||||
k = cursor.execute("UPDATE subscriptions SET user=NULL where status='CANCELLED' and updated<'"+date+"'"
|
||||
k = cursor.execute("UPDATE subscriptions SET user=0 where game="+str(int(game))+" and status='CANCELLED' and updated<'"+date+"'")
|
||||
print "Removing "+str(int(k))+" cancelled subscriptions."
|
||||
|
||||
k = cursor.execute("UPDATE subscriptions SET user=NULL where status='DEAD' and updated<'"+date+"'"
|
||||
k = cursor.execute("UPDATE subscriptions SET user=0 where game="+str(int(game))+" and status='DEAD' and updated<'"+date+"'")
|
||||
print "Removing "+str(int(k))+" dead subscriptions."
|
||||
|
||||
k = cursor.execute("SELECT max(lastturn) from subscriptions");
|
||||
lastturn = int(cursor.fetchone()[0])
|
||||
k = cursor.execute("UPDATE subscriptions SET status='CANCELLED' where lastturn+3<="+str(lastturn)
|
||||
k = cursor.execute("UPDATE subscriptions SET status='CANCELLED' where NMR>2"
|
||||
print "Cancelling "+str(int(k))+" subscriptions with 3+ NMRs."
|
||||
k = cursor.execute("UPDATE subscriptions SET status='CANCELLED' where game="+str(int(game))+" and status='ACTIVE' and lastturn+3<="+str(lastturn))
|
||||
print "Cancelling "+str(int(k))+" active subscriptions with 3+ NMRs."
|
||||
|
||||
k = cursor.execute("SELECT users.id FROM users, subscriptions WHERE users.id=subscriptions.user and subscriptions.status='ACTIVE' and subscriptions.game="+str(game))
|
||||
while k!=0:
|
||||
|
|
Loading…
Reference in New Issue