Enhancement 5074 (Adding possibility to cleanup_database.pl to purge only older sessi...
authorMarcel de Rooy <M.de.Rooy@rijksmuseum.nl>
Thu, 28 Oct 2010 13:05:20 +0000 (09:05 -0400)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 1 Nov 2010 22:02:15 +0000 (11:02 +1300)
commit5c4f27bd0df7b7557519660d752eeee3c9fb0c7c
treec95a79ab082d023710178de8c3cc9ae7432d7d3b
parenteb1a7e06917f54f88278b4056893f7a4cbff323a
Enhancement 5074 (Adding possibility to cleanup_database.pl to purge only older sessions) [UPDATED for master]

Currently, the misc/cronjobs script cleanup_database truncates the session table (deleting all records, including active sessions).
With an additional parameter sessdays, this behavior could be changed or (perhaps better) extended. If the parameter sessdays is passed along with a number of days, the script only deletes older session records. This is accomplished by examining the values of lasttime, atime or ctime in the record.
So, calling the script like:
  ./cleanup_database.pl -v -sessions -sessdays 7
will only delete sessions records older than 7 days. The "old style" call
  ./cleanup_database.pl -v -sessions
still works too and truncates the table as before.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
misc/cronjobs/cleanup_database.pl