Bug 10361: Add option to cleanup_database.pl to purge OPAC search history
authorMirko Tietgen <mirko@abunchofthings.net>
Tue, 11 Jun 2013 13:35:44 +0000 (15:35 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 4 Sep 2013 14:22:50 +0000 (14:22 +0000)
commit1d5a4a0a8187672f79f886f59842ca11e2a14e55
treebda6e081195287fd96e6048bf0ad8bad965ab5c7
parent52a6d2189d816d2414490bb171ca3387ac2999ac
Bug 10361: Add option to cleanup_database.pl to purge OPAC search history

Add an option to cleanup_database.pl to purge the search_history
entries older than X days.

Test plan:

- Apply patch
- Check that your test DB has some entries a little older than 30 days
  and a few ones even older than that in search_history:

  SELECT * FROM search_history WHERE time < DATE_SUB( NOW(), INTERVAL 30 DAY );

  If not, modify some existing entries.

- Run cleanup_database with a fixed number of days (replace XX with
  something higher than 30)

  /misc/cronjobs/cleanup_database.pl --searchhistory XX

- Check that entries older than XX days got deleted from search_history
- Run without the day parameter
  /misc/cronjobs/cleanup_database.pl --searchhistory
- Check that entries older than 30 days got deleted from search_history

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Search.pm
misc/cronjobs/cleanup_database.pl