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-11-14 09:44:35 +08:00
|
|
|
cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \
|
|
|
|
(db.quote_name('core_sessions'), db.quote_name('expire_date')))
|
|
|
|
cursor.execute("DELETE FROM %s WHERE %s < NOW() - INTERVAL '1 week'" % \
|
|
|
|
(db.quote_name('registration_challenges'), db.quote_name('request_date')))
|
2005-07-13 09:25:57 +08:00
|
|
|
db.commit()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
clean_up()
|