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

(-)a/misc/cronjobs/cleanup_database.pl (-83 / +79 lines)
Lines 58-115 sub usage { Link Here
58
    print STDERR <<USAGE;
58
    print STDERR <<USAGE;
59
Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS] [--statute-barred-fees DAYS] [--temp-uploads] [--temp-uploads-days DAYS] [--uploads-missing 0|1 ] [--statistics DAYS] [--deleted-catalog DAYS] [--deleted-patrons DAYS] [--old-issues DAYS] [--old-reserves DAYS] [--transfers DAYS]
59
Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS] [--statute-barred-fees DAYS] [--temp-uploads] [--temp-uploads-days DAYS] [--uploads-missing 0|1 ] [--statistics DAYS] [--deleted-catalog DAYS] [--deleted-patrons DAYS] [--old-issues DAYS] [--old-reserves DAYS] [--transfers DAYS]
60
60
61
   -h --help          prints this help message, and exits, ignoring all
61
   -h --help                    Prints this help message, and exits, ignoring all other options.
62
                      other options
62
   --confirm                    Confirmation flag, the script will be running in dry-run mode is not set.
63
   --confirm          Confirmation flag, the script will be running in dry-run mode is not set.
63
   --sessions                   Purge the sessions table.  If you use this while users 
64
   --sessions         purge the sessions table.  If you use this while users 
64
                                are logged into Koha, they will have to reconnect.
65
                      are logged into Koha, they will have to reconnect.
65
   --sessdays DAYS              Purge only sessions older than DAYS days.
66
   --sessdays DAYS    purge only sessions older than DAYS days.
66
   -v --verbose                 Will cause the script to give you a bit more information about the run.
67
   -v --verbose       will cause the script to give you a bit more information
67
   --zebraqueue DAYS            Purge completed zebraqueue entries older than DAYS days.
68
                      about the run.
68
                                Defaults to 30 days if no days specified.
69
   --zebraqueue DAYS  purge completed zebraqueue entries older than DAYS days.
69
   -m --mail DAYS               Purge items from the mail queue that are older than DAYS days.
70
                      Defaults to 30 days if no days specified.
70
                                Defaults to 30 days if no days specified.
71
   -m --mail DAYS     purge items from the mail queue that are older than DAYS days.
71
   --merged                     Purge completed entries from need_merge_authorities.
72
                      Defaults to 30 days if no days specified.
72
   --import DAYS                Purge records from import tables older than DAYS days.
73
   --merged           purged completed entries from need_merge_authorities.
73
                                Defaults to 60 days if no days specified.
74
   --import DAYS      purge records from import tables older than DAYS days.
74
   --z3950                      Purge records from import tables that are the result of Z39.50 searches.
75
                      Defaults to 60 days if no days specified.
75
   --fees DAYS                  purge entries accountlines older than DAYS days, where
76
   --z3950            purge records from import tables that are the result
76
                                amountoutstanding is 0 or NULL.
77
                      of Z39.50 searches
77
                                DAYS must be greater than or equal to 1.
78
   --fees DAYS        purge entries accountlines older than DAYS days, where
78
   --statute-barred-fees DAYS   Purge entries accountlines older than DAYS days, where
79
                      amountoutstanding is 0 or NULL.
79
                                status is RETURNED and amountoutstanding is greater than 0.
80
                      In the case of --fees, DAYS must be greater than
80
                                DAYS must be greater than or equal to 1.
81
                      or equal to 1.
81
   --logs DAYS                  Purge entries from action_logs older than DAYS days.
82
   --statute-barred-fees DAYS    Purge entries accountlines older than DAYS days, where
82
                                Defaults to 180 days if no days specified.
83
                                 status is RETURNED and amountoutstanding is greater than 0.
83
   --searchhistory DAYS         Purge entries from search_history older than DAYS days.
84
                                 In the case of --statute-barred-fees, DAYS must be greater than
84
                                Defaults to 30 days if no days specified
85
                                 or equal to 1.
85
   --list-invites  DAYS         Purge (unaccepted) list share invites older than DAYS days.
86
   --logs DAYS        purge entries from action_logs older than DAYS days.
86
                                Defaults to 14 days if no days specified.
87
                      Defaults to 180 days if no days specified.
87
   --restrictions DAYS          Purge patrons restrictions expired since more than DAYS days.
88
   --searchhistory DAYS  purge entries from search_history older than DAYS days.
88
                                Defaults to 30 days if no days specified.
89
                         Defaults to 30 days if no days specified
89
    --all-restrictions          Purge all expired patrons restrictions.
90
   --list-invites  DAYS  purge (unaccepted) list share invites older than DAYS
90
   --del-exp-selfreg            Delete expired self registration accounts.
91
                         days.  Defaults to 14 days if no days specified.
91
   --del-unv-selfreg  DAYS      Delete unverified self registrations older than DAYS.
92
   --restrictions DAYS   purge patrons restrictions expired since more than DAYS days.
92
   --unique-holidays DAYS       Delete all unique holidays older than DAYS.
93
                         Defaults to 30 days if no days specified.
93
   --temp-uploads               Delete temporary uploads.
94
    --all-restrictions   purge all expired patrons restrictions.
94
   --temp-uploads-days DAYS     Override the corresponding preference value.
95
   --del-exp-selfreg  Delete expired self registration accounts
95
   --uploads-missing FLAG       Delete upload records for missing files when FLAG is true, count them otherwise.
96
   --del-unv-selfreg  DAYS  Delete unverified self registrations older than DAYS
96
   --oauth-tokens               Delete expired OAuth2 tokens.
97
   --unique-holidays DAYS  Delete all unique holidays older than DAYS
97
   --statistics DAYS            Purge statistics entries more than DAYS days old.
98
   --temp-uploads     Delete temporary uploads.
98
                                This table is used to build reports, make sure you are aware of the consequences
99
   --temp-uploads-days DAYS Override the corresponding preference value.
99
                                of this before using it!
100
   --uploads-missing FLAG Delete upload records for missing files when FLAG is true, count them otherwise
100
   --deleted-catalog  DAYS      Purge catalog records deleted more then DAYS days ago
101
   --oauth-tokens     Delete expired OAuth2 tokens
101
                                (from tables deleteditems, deletedbiblioitems, deletedbiblio_metadata
102
   --statistics DAYS       Purge statistics entries more than DAYS days old.
102
                                and deletedbiblio).
103
                           This table is used to build reports, make sure you are aware of the consequences of this before using it!
103
   --deleted-patrons DAYS       Purge patrons deleted more than DAYS days ago.
104
   --deleted-catalog  DAYS Purge catalog records deleted more then DAYS days ago
104
   --old-issues DAYS            Purge checkouts (old_issues) returned more than DAYS days ago.
105
                           (from tables deleteditems, deletedbiblioitems, deletedbiblio_metadata and deletedbiblio).
105
   --old-reserves DAYS          Purge reserves (old_reserves) more than DAYS old.
106
   --deleted-patrons DAYS  Purge patrons deleted more than DAYS days ago.
106
   --transfers DAYS             Purge transfers completed more than DAYS day ago.
107
   --old-issues DAYS       Purge checkouts (old_issues) returned more than DAYS days ago.
107
   --pseudo-transactions DAYS   Purge the pseudonymized transactions that have been originally created more
108
   --old-reserves DAYS     Purge reserves (old_reserves) more than DAYS old.
108
                                than DAYS days ago. DAYS is optional and can be replaced by:
109
   --transfers DAYS        Purge transfers completed more than DAYS day ago.
109
                                --pseudo-transactions-from YYYY-MM-DD and/or --pseudo-transactions-to YYYY-MM-DD
110
   --pseudo-transactions DAYS   Purge the pseudonymized transactions that have been originally created more than DAYS days ago
111
                                DAYS is optional and can be replaced by:
112
                                    --pseudo-transactions-from YYYY-MM-DD and/or --pseudo-transactions-to YYYY-MM-DD
113
USAGE
110
USAGE
114
    exit $_[0];
111
    exit $_[0];
115
}
112
}
Lines 147-182 my $pTransfers; Link Here
147
my ( $pPseudoTransactions, $pPseudoTransactionsFrom, $pPseudoTransactionsTo );
144
my ( $pPseudoTransactions, $pPseudoTransactionsFrom, $pPseudoTransactionsTo );
148
145
149
GetOptions(
146
GetOptions(
150
    'h|help'            => \$help,
147
    'h|help'                     => \$help,
151
    'confirm'           => \$confirm,
148
    'confirm'                    => \$confirm,
152
    'sessions'          => \$sessions,
149
    'sessions'                   => \$sessions,
153
    'sessdays:i'        => \$sess_days,
150
    'sessdays:i'                 => \$sess_days,
154
    'v|verbose'         => \$verbose,
151
    'v|verbose'                  => \$verbose,
155
    'm|mail:i'          => \$mail,
152
    'm|mail:i'                   => \$mail,
156
    'zebraqueue:i'      => \$zebraqueue_days,
153
    'zebraqueue:i'               => \$zebraqueue_days,
157
    'merged'            => \$purge_merged,
154
    'merged'                     => \$purge_merged,
158
    'import:i'          => \$pImport,
155
    'import:i'                   => \$pImport,
159
    'z3950'             => \$pZ3950,
156
    'z3950'                      => \$pZ3950,
160
    'logs:i'            => \$pLogs,
157
    'logs:i'                     => \$pLogs,
161
    'fees:i'            => \$fees_days,
158
    'fees:i'                     => \$fees_days,
162
    'statute-barred-fees:i' => \$statue_barred_fees_days,
159
    'statute-barred-fees:i'      => \$statue_barred_fees_days,
163
    'searchhistory:i'   => \$pSearchhistory,
160
    'searchhistory:i'            => \$pSearchhistory,
164
    'list-invites:i'    => \$pListShareInvites,
161
    'list-invites:i'             => \$pListShareInvites,
165
    'restrictions:i'    => \$pDebarments,
162
    'restrictions:i'             => \$pDebarments,
166
    'all-restrictions'  => \$allDebarments,
163
    'all-restrictions'           => \$allDebarments,
167
    'del-exp-selfreg'   => \$pExpSelfReg,
164
    'del-exp-selfreg'            => \$pExpSelfReg,
168
    'del-unv-selfreg'   => \$pUnvSelfReg,
165
    'del-unv-selfreg'            => \$pUnvSelfReg,
169
    'unique-holidays:i' => \$special_holidays_days,
166
    'unique-holidays:i'          => \$special_holidays_days,
170
    'temp-uploads'      => \$temp_uploads,
167
    'temp-uploads'               => \$temp_uploads,
171
    'temp-uploads-days:i' => \$temp_uploads_days,
168
    'temp-uploads-days:i'        => \$temp_uploads_days,
172
    'uploads-missing:i' => \$uploads_missing,
169
    'uploads-missing:i'          => \$uploads_missing,
173
    'oauth-tokens'      => \$oauth_tokens,
170
    'oauth-tokens'               => \$oauth_tokens,
174
    'statistics:i'      => \$pStatistics,
171
    'statistics:i'               => \$pStatistics,
175
    'deleted-catalog:i' => \$pDeletedCatalog,
172
    'deleted-catalog:i'          => \$pDeletedCatalog,
176
    'deleted-patrons:i' => \$pDeletedPatrons,
173
    'deleted-patrons:i'          => \$pDeletedPatrons,
177
    'old-issues:i'      => \$pOldIssues,
174
    'old-issues:i'               => \$pOldIssues,
178
    'old-reserves:i'    => \$pOldReserves,
175
    'old-reserves:i'             => \$pOldReserves,
179
    'transfers:i'       => \$pTransfers,
176
    'transfers:i'                => \$pTransfers,
180
    'pseudo-transactions:i'      => \$pPseudoTransactions,
177
    'pseudo-transactions:i'      => \$pPseudoTransactions,
181
    'pseudo-transactions-from:s' => \$pPseudoTransactionsFrom,
178
    'pseudo-transactions-from:s' => \$pPseudoTransactionsFrom,
182
    'pseudo-transactions-to:s'   => \$pPseudoTransactionsTo,
179
    'pseudo-transactions-to:s'   => \$pPseudoTransactionsTo,
183
- 

Return to bug 27080