Commit 062d3e88 authored by Anastasia Galkin's avatar Anastasia Galkin
Browse files

gardening

parent d53c3e9d
......@@ -9,14 +9,13 @@ from settings import *
log_name = '' + time.strftime("%Y%m%d_%H%M%S") + '_wordpress_stats.log'
file = open(log_name, "w")
# Open database connection
for i, wp in WORDPRESS_DATABASES.items():
file.write("Wordpress: '{0}' ".format(i) + '\n')
nonews = True
db = MySQLdb.connect(wp['HOST'],wp['USER'],wp['PASSWORD'],wp['DATABASE'])
db = MySQLdb.connect(wp['HOST'], wp['USER'], wp['PASSWORD'], wp['DATABASE'])
cursor = db.cursor()
# users, posts, pages
......@@ -27,7 +26,7 @@ for i, wp in WORDPRESS_DATABASES.items():
if int(count[0]) > 0:
nonews = False
file.write("{0} new {1}\n".format(''.join(map(str,count)), j) )
file.write("{0} new {1}\n".format(''.join(map(str, count)), j))
file.write(stats['header'] + "\n")
cursor.execute(stats['query'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment