diff --git a/django/bin/daily_cleanup.py b/django/bin/daily_cleanup.py index 6eb5c17feb..667e0f16c6 100644 --- a/django/bin/daily_cleanup.py +++ b/django/bin/daily_cleanup.py @@ -1,16 +1,17 @@ -"Daily cleanup file" +""" +Daily cleanup job. + +Can be run as a cronjob to clean out old data from the database (only expired +sessions at the moment). +""" from django.db import backend, connection, transaction -DOCUMENTATION_DIRECTORY = '/home/html/documentation/' - def clean_up(): # Clean up old database records cursor = connection.cursor() cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \ - (backend.quote_name('core_sessions'), backend.quote_name('expire_date'))) - cursor.execute("DELETE FROM %s WHERE %s < NOW() - INTERVAL '1 week'" % \ - (backend.quote_name('registration_challenges'), backend.quote_name('request_date'))) + (backend.quote_name('django_session'), backend.quote_name('expire_date'))) transaction.commit_unless_managed() if __name__ == "__main__":