Bugzilla – Attachment 36750 Details for
Bug 13811
Silent Cronjobs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
check-url's --html option prints directly to a file instead of stdout.
check-urls---html-option-prints-directly-to-a-file.patch (text/plain), 3.04 KB, created by
Maxime Beaulieu
on 2015-03-09 19:20:18 UTC
(
hide
)
Description:
check-url's --html option prints directly to a file instead of stdout.
Filename:
MIME Type:
Creator:
Maxime Beaulieu
Created:
2015-03-09 19:20:18 UTC
Size:
3.04 KB
patch
obsolete
>From 5a96e79b2d75c81f885bb4753af40af4facb07c8 Mon Sep 17 00:00:00 2001 >From: mxbeaulieu <maxime.beaulieu@inlibro.com> >Date: Mon, 9 Mar 2015 14:57:10 -0400 >Subject: [PATCH] check-url's --html option prints directly to a file instead > of stdout. > >This change makes the option behave more like other cronjob's --html or --csv options. >It also makes the script silent while printing html, as nothing is printed to stdout unless the verbose option is passed. > >The script's behaviour is not changed when launched without options. (Prints in stdout) > >sponsored by: CCSR > >http://bugs.koha-community.org/show_bug.cgi?id=13811 >--- > misc/cronjobs/check-url.pl | 32 ++++++++++++++++++-------------- > 1 file changed, 18 insertions(+), 14 deletions(-) > >diff --git a/misc/cronjobs/check-url.pl b/misc/cronjobs/check-url.pl >index 589a4c5..c39fd09 100755 >--- a/misc/cronjobs/check-url.pl >+++ b/misc/cronjobs/check-url.pl >@@ -155,20 +155,20 @@ my $verbose = 0; > my $help = 0; > my $host = ''; > my $host_pro = ''; >-my $html = 0; >+my $html = ''; > my $uriedit = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber="; > my $agent = ''; > my $timeout = 15; > GetOptions( > 'verbose' => \$verbose, >- 'html' => \$html, >+ 'html:s' => \$html, > 'help' => \$help, > 'host=s' => \$host, > 'host-pro=s' => \$host_pro, > 'agent=s' => \$agent, > 'timeout=i', => \$timeout, > ); >- >+my $htmlfh; > > sub usage { > pod2usage( -verbose => 2 ); >@@ -195,8 +195,8 @@ sub check_all_url { > my $sth = $dbh->prepare( > "SELECT biblionumber FROM biblioitems WHERE url <> ''" ); > $sth->execute; >- if ( $html ) { >- print <<EOS; >+ if ( $htmlfh ) { >+ print $htmlfh <<EOS; > <html> > <body> > <table> >@@ -207,16 +207,17 @@ EOS > next unless $result; # No URL > foreach my $url ( @$result ) { > if ( ! $url->{ is_success } || $verbose ) { >- print $html >- ? "<tr>\n<td>" . bibediturl( $biblionumber ) . >- "</td>\n<td>" . $url->{url} . "</td>\n<td>" . >- $url->{status} . "</td>\n</tr>\n\n" >- : "$biblionumber\t" . $url->{ url } . "\t" . >- $url->{ status } . "\n"; >+ if($htmlfh){ >+ my $message = "<tr>\n<td>" . bibediturl( $biblionumber ) . >+ "</td>\n<td>" . $url->{url} . "</td>\n<td>" . >+ $url->{status} . "</td>\n</tr>\n\n"; >+ print $htmlfh $message; >+ } >+ print "$biblionumber\t$url->{ url }\t$url->{ status }\n" if (!$htmlfh || $verbose); > } > } > } >- print "</table>\n</body>\n</html>\n" if $html; >+ print $htmlfh "</table>\n</body>\n</html>\n" if $htmlfh; > } > > >@@ -233,8 +234,11 @@ if ( $html && !$host_pro ) { > exit; > } > } >- >-check_all_url(); >+if($html){ >+ open($htmlfh, '>', $html) or die $!; >+} >+check_all_url(); >+close $htmlfh if $htmlfh; > > > >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13811
:
36749
| 36750