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