summaryrefslogtreecommitdiff
path: root/django/bin
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-09-26 13:08:16 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-09-26 13:08:16 +0000
commit1f8cc30f5f525ac53134b7d24cb8afeb7bcd0538 (patch)
tree8b15f7f15aa2f7132de5fec19cbdcc74c848da1f /django/bin
parentcb829267b83d4bc5db0e7c93fc5c78feea2a6c25 (diff)
Fixed #2748 -- Turned daily_cleanup.py into something that will run against the
current version of Django. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3860 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/bin')
-rw-r--r--django/bin/daily_cleanup.py13
1 files changed, 7 insertions, 6 deletions
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.
-from django.db import backend, connection, transaction
+Can be run as a cronjob to clean out old data from the database (only expired
+sessions at the moment).
+"""
-DOCUMENTATION_DIRECTORY = '/home/html/documentation/'
+from django.db import backend, connection, transaction
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__":