#
# Copyright 2009 Tamil s.a.r.l.
#
-# This software is placed under the gnu General Public License, v2
-# (http://www.gnu.org/licenses/gpl.html)
+# This file is part of Koha.
#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"is_success: ", $url->{ is_success }, "\n",
"status: ", $url->{ status }, "\n";
}
-
+
=head1 FUNCTIONS
=head2 new
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 } = { };
my $host_pro = '';
my $html = 0;
my $uriedit = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=";
+my $agent = '';
my $timeout = 15;
GetOptions(
'verbose' => \$verbose,
'help' => \$help,
'host=s' => \$host,
'host-pro=s' => \$host_pro,
+ 'agent=s' => \$agent,
'timeout=i', => \$timeout,
);
# 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( );
=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
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.