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

(-)a/misc/cronjobs/check-url.pl (-4 / +12 lines)
Lines 85-93 use C4::Biblio; Link Here
85
sub new {
85
sub new {
86
86
87
    my $self = {};
87
    my $self = {};
88
    my ($class, $timeout) = @_;
88
    my ($class, $timeout, $agent) = @_;
89
    
89
    
90
    my $uagent = new LWP::UserAgent;
90
    my $uagent = new LWP::UserAgent;
91
    $uagent->agent( $agent ) if $agent;
91
    $uagent->timeout( $timeout) if $timeout;
92
    $uagent->timeout( $timeout) if $timeout;
92
    $self->{ user_agent } = $uagent;
93
    $self->{ user_agent } = $uagent;
93
    $self->{ bad_url    } = { };
94
    $self->{ bad_url    } = { };
Lines 156-161 my $host = ''; Link Here
156
my $host_pro    = '';
157
my $host_pro    = '';
157
my $html        = 0;
158
my $html        = 0;
158
my $uriedit     = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=";
159
my $uriedit     = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=";
160
my $agent       = '';
159
my $timeout     = 15;
161
my $timeout     = 15;
160
GetOptions( 
162
GetOptions( 
161
    'verbose'       => \$verbose,
163
    'verbose'       => \$verbose,
Lines 163-168 GetOptions( Link Here
163
    'help'          => \$help,
165
    'help'          => \$help,
164
    'host=s'        => \$host,
166
    'host=s'        => \$host,
165
    'host-pro=s'    => \$host_pro,
167
    'host-pro=s'    => \$host_pro,
168
    'agent=s'       => \$agent;
166
    'timeout=i',    => \$timeout,
169
    'timeout=i',    => \$timeout,
167
);
170
);
168
171
Lines 184-190 sub bibediturl { Link Here
184
# Check all URLs from all current Koha biblio records
187
# Check all URLs from all current Koha biblio records
185
#
188
#
186
sub check_all_url {
189
sub check_all_url {
187
    my $checker = C4::URL::Checker->new($timeout);
190
    my $checker = C4::URL::Checker->new($timeout,$agent);
188
    $checker->{ host_default }  = $host;
191
    $checker->{ host_default }  = $host;
189
    
192
    
190
    my $context = new C4::Context(  );  
193
    my $context = new C4::Context(  );  
Lines 243-249 check-url.pl - Check URLs from 856$u field. Link Here
243
246
244
=over
247
=over
245
248
246
=item check-url.pl [--verbose|--help] [--host=http://default.tld] 
249
=item check-url.pl [--verbose|--help] [--agent=agent-string] [--host=http://default.tld]
247
250
248
Scan all URLs found in 856$u of bib records 
251
Scan all URLs found in 856$u of bib records 
249
and display if resources are available or not.
252
and display if resources are available or not.
Lines 274-279 record in edit mode. With this parameter B<--host-pro> is required. Link Here
274
277
275
Server host used to link to biblio record editing page.
278
Server host used to link to biblio record editing page.
276
279
280
=item B<--agent=agent-string>
281
282
Change default libwww user-agent string to custom.  Some sites do
283
not like libwww user-agent and return false 40x failure codes,
284
so this allows Koha to report itself as Koha, or a browser.
285
277
=item B<--timeout=15>
286
=item B<--timeout=15>
278
287
279
Timeout for fetching URLs. By default 15 seconds.
288
Timeout for fetching URLs. By default 15 seconds.
280
- 

Return to bug 6267