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

(-)a/misc/cronjobs/cleanup_database.pl (-2 / +16 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 92-97 my ( Link Here
92
    $allDebarments,
95
    $allDebarments,
93
    $pExpSelfReg,
96
    $pExpSelfReg,
94
    $pUnvSelfReg,
97
    $pUnvSelfReg,
98
    $fees_days
99
    $help,   $sessions,          $sess_days, $verbose, $zebraqueue_days,
100
    $mail,   $purge_merged,      $pImport,   $pLogs,   $pSearchhistory,
101
    $pZ3950, $pListShareInvites, $pDebarments, $allDebarments,
95
);
102
);
96
103
97
GetOptions(
104
GetOptions(
Lines 105-110 GetOptions( Link Here
105
    'import:i'        => \$pImport,
112
    'import:i'        => \$pImport,
106
    'z3950'           => \$pZ3950,
113
    'z3950'           => \$pZ3950,
107
    'logs:i'          => \$pLogs,
114
    'logs:i'          => \$pLogs,
115
    'fees:i'          => \$fees_days,
108
    'searchhistory:i' => \$pSearchhistory,
116
    'searchhistory:i' => \$pSearchhistory,
109
    'list-invites:i'  => \$pListShareInvites,
117
    'list-invites:i'  => \$pListShareInvites,
110
    'restrictions:i'  => \$pDebarments,
118
    'restrictions:i'  => \$pDebarments,
Lines 133-138 unless ( $sessions Link Here
133
    || $purge_merged
141
    || $purge_merged
134
    || $pImport
142
    || $pImport
135
    || $pLogs
143
    || $pLogs
144
    || $fees_days
136
    || $pSearchhistory
145
    || $pSearchhistory
137
    || $pZ3950
146
    || $pZ3950
138
    || $pListShareInvites
147
    || $pListShareInvites
Lines 241-246 if ($pLogs) { Link Here
241
    print "Done with purging action_logs.\n" if $verbose;
250
    print "Done with purging action_logs.\n" if $verbose;
242
}
251
}
243
252
253
if ($fees_days) {
254
    print "Purging records from accountlines.\n" if $verbose;
255
    purge_zero_balance_fees( $fees_days );
256
    print "Done purging records from accountlines.\n" if $verbose;
257
}
258
244
if ($pSearchhistory) {
259
if ($pSearchhistory) {
245
    print "Purging records older than $pSearchhistory from search_history.\n" if $verbose;
260
    print "Purging records older than $pSearchhistory from search_history.\n" if $verbose;
246
    PurgeSearchHistory($pSearchhistory);
261
    PurgeSearchHistory($pSearchhistory);
247
- 

Return to bug 14402