Changeset 3860
- Timestamp:
- 09/26/06 08:08:16 (2 years ago)
- Files:
-
- django/trunk/django/bin/daily_cleanup.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/bin/daily_cleanup.py
r2809 r3860 1 "Daily cleanup file" 1 """ 2 Daily cleanup job. 3 4 Can be run as a cronjob to clean out old data from the database (only expired 5 sessions at the moment). 6 """ 2 7 3 8 from django.db import backend, connection, transaction 4 5 DOCUMENTATION_DIRECTORY = '/home/html/documentation/'6 9 7 10 def clean_up(): … … 9 12 cursor = connection.cursor() 10 13 cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \ 11 (backend.quote_name('core_sessions'), backend.quote_name('expire_date'))) 12 cursor.execute("DELETE FROM %s WHERE %s < NOW() - INTERVAL '1 week'" % \ 13 (backend.quote_name('registration_challenges'), backend.quote_name('request_date'))) 14 (backend.quote_name('django_session'), backend.quote_name('expire_date'))) 14 15 transaction.commit_unless_managed() 15 16
