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

(-)a/misc/cronjobs/cleanup_database.pl (-2 / +19 lines)
Lines 40-49 use C4::Search::History; Link Here
40
use Getopt::Long;
40
use Getopt::Long;
41
use C4::Log;
41
use C4::Log;
42
use C4::Accounts;
42
use C4::Accounts;
43
use Koha::UploadedFiles;
43
44
44
sub usage {
45
sub usage {
45
    print STDERR <<USAGE;
46
    print STDERR <<USAGE;
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]
47
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] [--temp-uploads] [--temp-uploads-override DAYS]
47
48
48
   -h --help          prints this help message, and exits, ignoring all
49
   -h --help          prints this help message, and exits, ignoring all
49
                      other options
50
                      other options
Lines 80-85 Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu Link Here
80
   --del-exp-selfreg  Delete expired self registration accounts
81
   --del-exp-selfreg  Delete expired self registration accounts
81
   --del-unv-selfreg  DAYS  Delete unverified self registrations older than DAYS
82
   --del-unv-selfreg  DAYS  Delete unverified self registrations older than DAYS
82
   --unique-holidays DAYS  Delete all unique holidays older than DAYS
83
   --unique-holidays DAYS  Delete all unique holidays older than DAYS
84
   --temp-uploads     Delete temporary uploads.
85
   --temp-uploads-override DAYS Override the corresponding preference value.
83
USAGE
86
USAGE
84
    exit $_[0];
87
    exit $_[0];
85
}
88
}
Lines 102-107 my $pExpSelfReg; Link Here
102
my $pUnvSelfReg;
105
my $pUnvSelfReg;
103
my $fees_days;
106
my $fees_days;
104
my $special_holidays_days;
107
my $special_holidays_days;
108
my $temp_uploads;
109
my $override_temp_uploads;
105
110
106
GetOptions(
111
GetOptions(
107
    'h|help'            => \$help,
112
    'h|help'            => \$help,
Lines 122-127 GetOptions( Link Here
122
    'del-exp-selfreg'   => \$pExpSelfReg,
127
    'del-exp-selfreg'   => \$pExpSelfReg,
123
    'del-unv-selfreg'   => \$pUnvSelfReg,
128
    'del-unv-selfreg'   => \$pUnvSelfReg,
124
    'unique-holidays:i' => \$special_holidays_days,
129
    'unique-holidays:i' => \$special_holidays_days,
130
    'temp-uploads'      => \$temp_uploads,
131
    'temp-uploads-override:i' => \$override_temp_uploads,
125
) || usage(1);
132
) || usage(1);
126
133
127
# Use default values
134
# Use default values
Lines 153-158 unless ( $sessions Link Here
153
    || $pExpSelfReg
160
    || $pExpSelfReg
154
    || $pUnvSelfReg
161
    || $pUnvSelfReg
155
    || $special_holidays_days
162
    || $special_holidays_days
163
    || $temp_uploads
156
) {
164
) {
157
    print "You did not specify any cleanup work for the script to do.\n\n";
165
    print "You did not specify any cleanup work for the script to do.\n\n";
158
    usage(1);
166
    usage(1);
Lines 302-307 if ($special_holidays_days) { Link Here
302
    DeleteSpecialHolidays( abs($special_holidays_days) );
310
    DeleteSpecialHolidays( abs($special_holidays_days) );
303
}
311
}
304
312
313
if( $temp_uploads ) {
314
    # Delete temporary uploads, governed by a pref.
315
    # If the pref is empty, nothing happens (unless you override).
316
    print "Purging temporary uploads.\n" if $verbose;
317
    Koha::UploadedFiles->delete_temporary({
318
        override_pref => $override_temp_uploads,
319
    });
320
    print "Done purging temporary uploads.\n" if $verbose;
321
}
322
305
exit(0);
323
exit(0);
306
324
307
sub RemoveOldSessions {
325
sub RemoveOldSessions {
308
- 

Return to bug 17669