X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=misc%2Fcronjobs%2Fcheck-url.pl;h=589a4c5dc547c12f786431b58816546586dead90;hb=92782d38328e712ddde5c7f879473c6cb46aaef3;hp=063eb7e7e8b5c4206bb729aef5d876b1d4e7c846;hpb=160e01daa36d40c424fa61400344c09d2709dc4e;p=koha_fer diff --git a/misc/cronjobs/check-url.pl b/misc/cronjobs/check-url.pl index 063eb7e7e8..589a4c5dc5 100755 --- a/misc/cronjobs/check-url.pl +++ b/misc/cronjobs/check-url.pl @@ -38,7 +38,7 @@ C4::URL::Checker - base object for checking URL stored in Koha DB "is_success: ", $url->{ is_success }, "\n", "status: ", $url->{ status }, "\n"; } - + =head1 FUNCTIONS =head2 new @@ -85,9 +85,10 @@ use C4::Biblio; sub new { my $self = {}; - my ($class, $timeout) = @_; + my ($class, $timeout, $agent) = @_; my $uagent = new LWP::UserAgent; + $uagent->agent( $agent ) if $agent; $uagent->timeout( $timeout) if $timeout; $self->{ user_agent } = $uagent; $self->{ bad_url } = { }; @@ -156,6 +157,7 @@ my $host = ''; my $host_pro = ''; my $html = 0; my $uriedit = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber="; +my $agent = ''; my $timeout = 15; GetOptions( 'verbose' => \$verbose, @@ -163,6 +165,7 @@ GetOptions( 'help' => \$help, 'host=s' => \$host, 'host-pro=s' => \$host_pro, + 'agent=s' => \$agent, 'timeout=i', => \$timeout, ); @@ -184,7 +187,7 @@ sub bibediturl { # Check all URLs from all current Koha biblio records # sub check_all_url { - my $checker = C4::URL::Checker->new($timeout); + my $checker = C4::URL::Checker->new($timeout,$agent); $checker->{ host_default } = $host; my $context = new C4::Context( ); @@ -243,10 +246,11 @@ check-url.pl - Check URLs from 856$u field. =over -=item check-url.pl [--verbose|--help] [--host=http://default.tld] +=item check-url.pl [--verbose|--help] [--agent=agent-string] [--host=http://default.tld] Scan all URLs found in 856$u of bib records and display if resources are available or not. +This script is deprecated. You should rather use check-url-quick.pl. =back @@ -274,6 +278,12 @@ record in edit mode. With this parameter B<--host-pro> is required. Server host used to link to biblio record editing page. +=item B<--agent=agent-string> + +Change default libwww user-agent string to custom. Some sites do +not like libwww user-agent and return false 40x failure codes, +so this allows Koha to report itself as Koha, or a browser. + =item B<--timeout=15> Timeout for fetching URLs. By default 15 seconds.