check-url-quick support redirect, skip invalid biblios
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 16 Apr 2020 08:06:34 +0000 (10:06 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 16 Apr 2020 08:06:34 +0000 (10:06 +0200)
misc/cronjobs/check-url-quick.pl

index 22d2dfe..0f77aaa 100755 (executable)
@@ -92,6 +92,7 @@ sub check_all_url {
             return if $count > $maxconn;
             while ( my ($biblionumber) = $sth->fetchrow ) {
                 my $record = GetMarcBiblio({ biblionumber => $biblionumber });
+               next unless $record;
                 for my $tag (@tags) {
                     foreach my $field ( $record->field($tag) ) {
                         my $url = $field->subfield('u');
@@ -107,7 +108,7 @@ sub check_all_url {
                                 my ( undef, $hdr ) = @_;
                                 $count--;
                                 report( $hdr, $biblionumber, $url )
-                                  if $hdr->{Status} !~ /^2/ || $verbose;
+                                  if $hdr->{Status} !~ /^[23]/ || $verbose;
                             },
                         );
                     }