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

(-)a/misc/cronjobs/cleanup_database.pl (-6 / +10 lines)
Lines 35-45 BEGIN { Link Here
35
    eval { require "$FindBin::Bin/../kohalib.pl" };
35
    eval { require "$FindBin::Bin/../kohalib.pl" };
36
}
36
}
37
37
38
use Getopt::Long;
39
38
use C4::Context;
40
use C4::Context;
39
use C4::Dates;
41
use C4::Dates;
40
use C4::Search;
42
use C4::Search;
41
use Getopt::Long;
42
use C4::Log;
43
use C4::Log;
44
use Koha::DateUtils;
43
45
44
sub usage {
46
sub usage {
45
    print STDERR <<USAGE;
47
    print STDERR <<USAGE;
Lines 69-76 Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu Link Here
69
                         days.  Defaults to 14 days if no days specified.
71
                         days.  Defaults to 14 days if no days specified.
70
   --restrictions DAYS   purge patrons restrictions expired since more than DAYS days.
72
   --restrictions DAYS   purge patrons restrictions expired since more than DAYS days.
71
                         Defaults to 30 days if no days specified.
73
                         Defaults to 30 days if no days specified.
72
    --all-restrictions   purge all expired patrons restrictions.
74
   --all-restrictions    purge all expired patrons restrictions.
73
   --del-exp-selfreg  Delete expired self registration accounts
75
   --del-exp-selfreg       Delete expired self registration accounts
74
   --del-unv-selfreg DAYS  Delete unverified self registrations older than DAYS
76
   --del-unv-selfreg DAYS  Delete unverified self registrations older than DAYS
75
   --holidays DAYS       purge special holidays that passed more then DAYS days ago.
77
   --holidays DAYS       purge special holidays that passed more then DAYS days ago.
76
                         Defaults to 30 days of no days specified.
78
                         Defaults to 30 days of no days specified.
Lines 391-401 sub DeleteUnverifiedSelfRegs { Link Here
391
}
393
}
392
394
393
sub PurgeHolidays {
395
sub PurgeHolidays {
396
    my $date = dt_from_string();
397
    $date->subtract( days => $pHolidays );
398
394
    $sth = $dbh->prepare(
399
    $sth = $dbh->prepare(
395
        q{
400
        q{
396
            DELETE FROM special_holidays
401
            DELETE FROM special_holidays
397
            WHERE DATE( CONCAT( year, '-', month, '-', day ) ) < DATE_SUB( CURDATE(), INTERVAL ? DAY )
402
            WHERE DATE( CONCAT( year, '-', month, '-', day ) ) < ?
398
        }
403
        }
399
    );
404
    );
400
    $sth->execute( $pHolidays ) or die $dbh->errstr;
405
    $sth->execute( $date->ymd ) or die $dbh->errstr;
401
}
406
}
402
- 

Return to bug 13409