blib/lib/WebEditor/OldFeatures/AdminHtdig.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 12 | 44 | 27.2 |
branch | 0 | 10 | 0.0 |
condition | 0 | 3 | 0.0 |
subroutine | 4 | 6 | 66.6 |
pod | 0 | 2 | 0.0 |
total | 16 | 65 | 24.6 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package WebEditor::OldFeatures::AdminHtdig; | ||||||
2 | |||||||
3 | 1 | 1 | 1208 | use strict; | |||
1 | 2 | ||||||
1 | 36 | ||||||
4 | 1 | 1 | 12 | use vars qw($VERSION); | |||
1 | 3 | ||||||
1 | 65 | ||||||
5 | $VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/); | ||||||
6 | |||||||
7 | 1 | 1 | 4 | use mixin::with 'WebEditor::OldController'; | |||
1 | 2 | ||||||
1 | 7 | ||||||
8 | |||||||
9 | 1 | 1 | 138 | use CGI qw(param); | |||
1 | 4 | ||||||
1 | 9 | ||||||
10 | |||||||
11 | sub mapping { | ||||||
12 | 0 | 0 | 0 | ("htdig" => "admin_htdig_module") | |||
13 | } | ||||||
14 | |||||||
15 | sub admin_htdig_module { | ||||||
16 | 0 | 0 | 0 | my($self, %args) = @_; | |||
17 | |||||||
18 | 0 | while(my($k,$v) = each %args) { | |||||
19 | 0 | param(substr($k,1), $v); | |||||
20 | } | ||||||
21 | |||||||
22 | 0 | 0 | 0 | if (param('host') eq 'live' && | |||
23 | $self->can("run_live_indexer")) { | ||||||
24 | 0 | return $self->run_live_indexer; | |||||
25 | } | ||||||
26 | |||||||
27 | 0 | my $c = $self->C; | |||||
28 | |||||||
29 | 0 | require WE_Frontend::Indexer::Htdig; | |||||
30 | |||||||
31 | 0 | local $| = 1; | |||||
32 | |||||||
33 | 0 | print < | |||||
34 | |||||||
39 | EOF | ||||||
40 | |||||||
41 | # refresh htdig-index | ||||||
42 | 0 | my $conf; | |||||
43 | 0 | 0 | if (param('host') eq 'live') { | ||||
0 | |||||||
44 | 0 | $c = $c->liveconfig; | |||||
45 | 0 | $conf = $c->searchengine->htdigconf; | |||||
46 | } elsif (param('host') =~ /^(prelive|local)$/) { | ||||||
47 | 0 | $conf = $c->searchengine->htdigconf; | |||||
48 | } | ||||||
49 | |||||||
50 | 0 | my $logfile = "/tmp/htdig_debug." . $< . ".log"; | |||||
51 | 0 | unlink $logfile; | |||||
52 | 0 | for my $lang (@{ $c->project->sitelanguages }) { | |||||
0 | |||||||
53 | 0 | print $self->_html_method("Erstelle Suchindex für die Sprache $lang") . " \n"; # XXX lang etc. |
|||||
54 | { | ||||||
55 | 0 | my $conf = WE_Frontend::Indexer::Htdig::generate_conf | |||||
0 | |||||||
56 | ($c, -htdigconf => $conf, -lang => $lang, -debug => 1); | ||||||
57 | 0 | my $silent = " >>$logfile 2>&1"; | |||||
58 | # my $silent = ""; | ||||||
59 | # XXX -c is always necessary? | ||||||
60 | 0 | my $cmd = $c->searchengine->searchindexer . $silent . " -c " . $conf; | |||||
61 | 0 | print "Kommando: $cmd \n"; |
|||||
62 | 0 | my $err = system $cmd; | |||||
63 | 0 | 0 | die "Fehler beim Kommando $cmd: $!" if $err; | ||||
64 | } | ||||||
65 | 0 | 0 | if (!WE_Frontend::Indexer::Htdig::conf_is_lang_dependent($conf)) { | ||||
66 | 0 | print $self->_html_method("Die Suchkonfiguration $conf gilt für alle weiteren Sprachen") . " \n"; |
|||||
67 | 0 | last; | |||||
68 | } | ||||||
69 | } | ||||||
70 | 0 | print "\n\n - fertig! "; |
|||||
71 | 0 | print ""; | |||||
72 | } | ||||||
73 | |||||||
74 | 1; |