Django

Code

Changeset 3860

Show
Ignore:
Timestamp:
09/26/06 08:08:16 (2 years ago)
Author:
mtredinnick
Message:

Fixed #2748 -- Turned daily_cleanup.py into something that will run against the
current version of Django.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/bin/daily_cleanup.py

    r2809 r3860  
    1 "Daily cleanup file" 
     1""" 
     2Daily cleanup job. 
     3 
     4Can be run as a cronjob to clean out old data from the database (only expired 
     5sessions at the moment). 
     6""" 
    27 
    38from django.db import backend, connection, transaction 
    4  
    5 DOCUMENTATION_DIRECTORY = '/home/html/documentation/' 
    69 
    710def clean_up(): 
     
    912    cursor = connection.cursor() 
    1013    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'))) 
    1415    transaction.commit_unless_managed() 
    1516