Bug 17578 [QA Followup] - Update number of tests
[koha.git] / misc / cronjobs / delete_unverified_opac_registrations.pl
blob13d5c4bdd142b7258e9a23e68abc6af7c10c5a27
1 #!/usr/bin/perl
3 # Copyright 2009-2010 Kyle Hall
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Modern::Perl;
21 use Getopt::Long;
23 BEGIN {
25 # find Koha's Perl modules
26 # test carefully before changing this
27 use FindBin;
28 eval { my $lib = "$FindBin::Bin/../kohalib.pl"; require $lib };
31 use C4::Context;
33 my $help;
34 my $confirm;
35 my $hours = 24;
37 GetOptions(
38 'h|help' => \$help,
39 'c|confirm' => \$confirm,
40 't|time=i' => \$hours,
42 my $usage = << 'ENDUSAGE';
44 IMPORTANT: You should no longer call this script. Please use
45 cleanup_database.pl with parameter --del-unv-selfreg.
47 This script removes unconfirmed OPAC based patron registrations
48 that have not been confirmed within the required time period.
50 This script has the following parameters :
51 -h --help: This message
53 -t --time: The length in hours to wait before removing an unconfirmed registration.
54 Defaults to 24 hours if not set.
56 -c --confirm: Without this flag set, this script will do nothing.
57 ENDUSAGE
59 if ( $help || !$confirm ) {
60 print $usage;
61 exit;
64 my $d= $hours>=24? int($hours/24): 1;
65 my $c= "$FindBin::Bin/cleanup_database.pl -del-unv-selfreg $d";
66 system($c);