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

(-)a/misc/cronjobs/check-url-quick.pl (-7 / +22 lines)
Lines 32-41 my ( $verbose, $help, $html ) = ( 0, 0, 0 ); Link Here
32
my ( $host,    $host_intranet ) = ( '', '' );
32
my ( $host,    $host_intranet ) = ( '', '' );
33
my ( $timeout, $maxconn )       = ( 10, 200 );
33
my ( $timeout, $maxconn )       = ( 10, 200 );
34
my @tags;
34
my @tags;
35
my $uriedit    = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=";
35
my $uriedit     = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=";
36
my $user_agent = 'Mozilla/5.0 (compatible; U; Koha checkurl)';
36
my $user_agent  = 'Mozilla/5.0 (compatible; U; Koha checkurl)';
37
my $whereclause = '';
37
GetOptions(
38
GetOptions(
38
    'verbose'         => \$verbose,
39
    'verbose+'        => \$verbose,
40
    'where:s'         => \$whereclause,
39
    'html'            => \$html,
41
    'html'            => \$html,
40
    'h|help'          => \$help,
42
    'h|help'          => \$help,
41
    'host=s'          => \$host,
43
    'host=s'          => \$host,
Lines 81-87 sub report { Link Here
81
# Check all URLs from all current Koha biblio records
83
# Check all URLs from all current Koha biblio records
82
84
83
sub check_all_url {
85
sub check_all_url {
84
    my $sth = C4::Context->dbh->prepare("SELECT biblionumber FROM biblioitems ORDER BY biblionumber");
86
    if ($whereclause) {
87
        $whereclause = "WHERE $whereclause";
88
    }
89
    my $sth = C4::Context->dbh->prepare("SELECT biblionumber FROM biblioitems $whereclause ORDER BY biblionumber");
85
    $sth->execute;
90
    $sth->execute;
86
91
87
    my $count = 0;                   # Number of requested URL
92
    my $count = 0;                   # Number of requested URL
Lines 108-115 sub check_all_url { Link Here
108
                            sub {
113
                            sub {
109
                                my ( undef, $hdr ) = @_;
114
                                my ( undef, $hdr ) = @_;
110
                                $count--;
115
                                $count--;
111
                                report( $hdr, $biblionumber, $url )
116
                                if ( $hdr->{Status} !~ /^2/ ) {
112
                                    if $hdr->{Status} !~ /^2/ || $verbose;
117
                                    http_request(
118
                                        GET     => $url,
119
                                        headers => { 'user-agent' => $user_agent },
120
                                        timeout => $timeout,
121
                                        sub {
122
                                            my ( undef, $hdr ) = @_;
123
                                            report( $hdr, $biblionumber, $url )
124
                                                if $hdr->{Status} !~ /^2/ || $verbose;
125
                                            print Data::Dumper::Dumper($hdr) if $verbose > 1;
126
                                        }
127
                                    );
128
                                }
113
                            },
129
                            },
114
                        );
130
                        );
115
                    }
131
                    }
116
- 

Return to bug 30614