Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/publish_blog_posts.py

21 lines
521 B
Python
Raw Permalink Normal View History

import shutil
import pymysql
db = pymysql.connect('localhost', 'kingofdog', '123456', 'kingofdog')
cur = db.cursor()
try:
unpublished_posts = cur.execute('update blog_posts set postState = 1 where postState = 3 and postPublishDate < now()')
db.commit()
shutil.rmtree('admin+blog')
shutil.rmtree('blog+index')
shutil.rmtree('blog+search')
shutil.rmtree('blog+tag')
shutil.rmtree('blog+category')
shutil.rmtree('blog+post')
except:
print('it didnt work')
db.rollback()
db.close()