WebEditor/OldFeatures/AdminHtdig.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« WebEditor/OldFeatures/AdminGroup.pm ↑ Summary WebEditor/OldFeatures/MakePDF.pm »
1 package WebEditor::OldFeatures::AdminHtdig;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 $VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/);
6  
7 1 ▶use mixin::with 'WebEditor::OldController';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶use CGI qw(param);
Subroutine BEGIN: called CC=1 SCAR=2.6
10  
11 sub mapping {
12 ("htdig" => "admin_htdig_module")
13 }
14  
15 sub admin_htdig_module {
16 my($self, %args) = @_;
17  
18 while(my($k,$v) = each %args) {
19 param(substr($k,1), $v);
20 }
21  
22 if (param('host') eq 'live' &&
23 $self->can("run_live_indexer")) {
24 return $self->run_live_indexer;
25 }
26  
27 my $c = $self->C;
28  
29 require WE_Frontend::Indexer::Htdig;
30  
31 local $| = 1;
32  
33 print <<EOF;
34 <script>
35 if (top.mainpanel && top.mainpanel.setwait) {
36 top.mainpanel.setwait(1, 'erstelle Suchindex...');
37 }
38 </script>
39 EOF
40  
41 # refresh htdig-index
42 my $conf;
43 if (param('host') eq 'live') {
44 $c = $c->liveconfig;
45 $conf = $c->searchengine->htdigconf;
46 } elsif (param('host') =~ /^(prelive|local)$/) {
47 $conf = $c->searchengine->htdigconf;
48 }
49  
50 my $logfile = "/tmp/htdig_debug." . $< . ".log";
51 unlink $logfile;
52 for my $lang (@{ $c->project->sitelanguages }) {
53 print $self->_html_method("Erstelle Suchindex für die Sprache $lang") . "<br>\n"; # XXX lang etc.
54 {
55 my $conf = WE_Frontend::Indexer::Htdig::generate_conf
56 ($c, -htdigconf => $conf, -lang => $lang, -debug => 1);
57 my $silent = " >>$logfile 2>&1";
58 # my $silent = "";
59 # XXX -c is always necessary?
60 my $cmd = $c->searchengine->searchindexer . $silent . " -c " . $conf;
61 print "Kommando: $cmd<br>\n";
62 my $err = system $cmd;
63 die "Fehler beim Kommando $cmd: $!" if $err;
64 }
65 if (!WE_Frontend::Indexer::Htdig::conf_is_lang_dependent($conf)) {
66 print $self->_html_method("Die Suchkonfiguration $conf gilt für alle weiteren Sprachen") . "<br>\n";
67 last;
68 }
69 }
70 print "\n\n<br><br> - fertig!<br><hr><br>";
71 print "<script>top.mainpanel.setwait(0);</script>";
72 }
73  
74 1;
« WebEditor/OldFeatures/AdminGroup.pm ↑ Summary WebEditor/OldFeatures/MakePDF.pm »