View | Details | Raw Unified | Return to bug 14402
Collapse All | Expand All

(-)a/misc/cronjobs/cleanup_database.pl (-2 / +13 lines)
Lines 39-48 use C4::Dates; Link Here
39
use C4::Search;
39
use C4::Search;
40
use Getopt::Long;
40
use Getopt::Long;
41
use C4::Log;
41
use C4::Log;
42
use C4::Accounts;
42
43
43
sub usage {
44
sub usage {
44
    print STDERR <<USAGE;
45
    print STDERR <<USAGE;
45
Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions]
46
Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS]
46
47
47
   -h --help          prints this help message, and exits, ignoring all
48
   -h --help          prints this help message, and exits, ignoring all
48
                      other options
49
                      other options
Lines 60-65 Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu Link Here
60
                      Defaults to 60 days if no days specified.
61
                      Defaults to 60 days if no days specified.
61
   --z3950            purge records from import tables that are the result
62
   --z3950            purge records from import tables that are the result
62
                      of Z39.50 searches
63
                      of Z39.50 searches
64
   --fees DAYS        purge entries accountlines older than DAYS days, where
65
                      amountoutstanding is 0.
63
   --logs DAYS        purge entries from action_logs older than DAYS days.
66
   --logs DAYS        purge entries from action_logs older than DAYS days.
64
                      Defaults to 180 days if no days specified.
67
                      Defaults to 180 days if no days specified.
65
   --searchhistory DAYS  purge entries from search_history older than DAYS days.
68
   --searchhistory DAYS  purge entries from search_history older than DAYS days.
Lines 77-82 my ( Link Here
77
    $help,   $sessions,          $sess_days, $verbose, $zebraqueue_days,
80
    $help,   $sessions,          $sess_days, $verbose, $zebraqueue_days,
78
    $mail,   $purge_merged,      $pImport,   $pLogs,   $pSearchhistory,
81
    $mail,   $purge_merged,      $pImport,   $pLogs,   $pSearchhistory,
79
    $pZ3950, $pListShareInvites, $pDebarments, $allDebarments,
82
    $pZ3950, $pListShareInvites, $pDebarments, $allDebarments,
83
    $fees_days
80
);
84
);
81
85
82
GetOptions(
86
GetOptions(
Lines 90-95 GetOptions( Link Here
90
    'import:i'        => \$pImport,
94
    'import:i'        => \$pImport,
91
    'z3950'           => \$pZ3950,
95
    'z3950'           => \$pZ3950,
92
    'logs:i'          => \$pLogs,
96
    'logs:i'          => \$pLogs,
97
    'fees:i'          => \$fees_days,
93
    'searchhistory:i' => \$pSearchhistory,
98
    'searchhistory:i' => \$pSearchhistory,
94
    'list-invites:i'  => \$pListShareInvites,
99
    'list-invites:i'  => \$pListShareInvites,
95
    'restrictions:i'  => \$pDebarments,
100
    'restrictions:i'  => \$pDebarments,
Lines 116-121 unless ( $sessions Link Here
116
    || $purge_merged
121
    || $purge_merged
117
    || $pImport
122
    || $pImport
118
    || $pLogs
123
    || $pLogs
124
    || $fees_days
119
    || $pSearchhistory
125
    || $pSearchhistory
120
    || $pZ3950
126
    || $pZ3950
121
    || $pListShareInvites
127
    || $pListShareInvites
Lines 222-227 if ($pLogs) { Link Here
222
    print "Done with purging action_logs.\n" if $verbose;
228
    print "Done with purging action_logs.\n" if $verbose;
223
}
229
}
224
230
231
if ($fees_days) {
232
    print "Purging records from accountlines.\n" if $verbose;
233
    purge_zero_balance_fees( $fees_days );
234
    print "Done purging records from accountlines.\n" if $verbose;
235
}
236
225
if ($pSearchhistory) {
237
if ($pSearchhistory) {
226
    print "Purging records older than $pSearchhistory from search_history.\n" if $verbose;
238
    print "Purging records older than $pSearchhistory from search_history.\n" if $verbose;
227
    PurgeSearchHistory($pSearchhistory);
239
    PurgeSearchHistory($pSearchhistory);
228
- 

Return to bug 14402