7d22a0358c3f9ab020a96df2e50398328ab8c8fc
[irspy-moved-to-github.git] / web / htdocs / details / check.mc
1 %# $Id: check.mc,v 1.18 2007-05-09 10:45:14 mike Exp $
2 <%args>
3 @id
4 $test => "Quick"
5 $really => 0
6 $YAZ_LOG => "irspy,irspy_test"
7 </%args>
8 <%perl>
9 my $allTargets = (@id == 1 && $id[0] eq "");
10 if ($allTargets && !$really) {
11 </%perl>
12      <h2>Warning</h2>
13      <p class="error">
14       Testing all the targets is a very slow process.
15       Are you sure you want to do this?
16      </p>
17      <p>
18       <a href="?really=1&amp;test=Quick">Yes: Quick Test</a><br/>
19       <a href="?really=1&amp;test=Main">Yes: Full Test</a><br/>
20       <a href="/">No</a><br/>
21      </p>
22 <%perl>
23 } else {
24
25 print "<h2>Testing ...</h2>\n";
26 print "     <ul>\n", join("", map { "      <li>$_</li>\n" } @id), "</ul>\n"
27     if !$allTargets;
28 print "<p>Logging: <tt>", join("/", split /,/, $YAZ_LOG), "</tt></p>\n";
29 $m->flush_buffer();
30
31 # Turning on autoflush with $m->autoflush() doesn't seem to work if
32 # even if the "MasonEnableAutoflush" configuration parameter is turned
33 # on in the HTTP configuration, so we don't even try -- instead,
34 # having ZOOM::IRSpy::Web::log() explicitly calling $m->flush_buffer()
35
36 my $db = ZOOM::IRSpy::connect_to_registry();
37 my $spy = new ZOOM::IRSpy::Web($db,
38                                admin => "fruitbat");
39 $spy->log_init_level($YAZ_LOG);
40 $spy->targets(@id) if !$allTargets;
41 $spy->initialise($test);
42 my $res = $spy->check();
43 print "<p>\n";
44 if ($res == 0) {
45     print "<b>All tests were attempted</b>\n";
46 } else {
47     print "<b>$res tests were skipped</b>\n";
48 }
49 print "</p>\n";
50 }
51 </%perl>