2005-07-13 09:25:57 +08:00
|
|
|
"Daily cleanup file"
|
|
|
|
|
|
|
|
from django.core.db import db
|
|
|
|
|
|
|
|
DOCUMENTATION_DIRECTORY = '/home/html/documentation/'
|
|
|
|
|
|
|
|
def clean_up():
|
|
|
|
# Clean up old database records
|
|
|
|
cursor = db.cursor()
|
2005-08-17 06:54:05 +08:00
|
|
|
cursor.execute("DELETE FROM core_sessions WHERE expire_date < NOW()")
|
2005-07-13 09:25:57 +08:00
|
|
|
cursor.execute("DELETE FROM registration_challenges WHERE request_date < NOW() - INTERVAL '1 week'")
|
|
|
|
db.commit()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
clean_up()
|