WebEditor/OldFeatures/KeyDB.pm

filter: Statementstmt 29.7% 11 / 37 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 1 totaltotal 25.9% 14 / 54 CC 9 SCAR 31.5
CC
9
Cov
24%
updatekeydb
30.0
__ANON__
30.0
BEGIN
1.0
CRAP 23.3
« WE_Frontend/Publish/Tgz.pm ↑ Summary WE/Util/Htpasswd.pm »
1 package WebEditor::OldFeatures::KeyDB;
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 1 $VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
6  
7 1 ▶use WE::Util::LangString qw(langstring);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 ######################################################################
10 #
11 # updating keyword database
12 #
13 0 ▶sub updatekeydb {
Subroutine updatekeydb: not called CC=5 SCAR=34.0
Pod undocumented
14 0 my $self = shift;
15  
16 0 my $root = $self->Root;
17 0 my $objdb = $root->ObjDB;
18 0 my $c = $self->C;
19  
20 0 my ($folder_id) = 0;
21 0 my %keywords;
22 my %id2title;
23  
24 0 foreach my $lang (@{ $c->project->sitelanguages }) {
25 # "Walk" through every object
26 0 ▶ $objdb->walk($folder_id, sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
27 0 my ($id) = @_;
28 0 my $obj = $objdb->get_object($id);
29 # Check if object is released
30 #print "<br>$id : ";
31 0 ▶ if ($obj->Release_State eq 'released' && $obj->Keywords) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->Release_State eq "released" and $obj->Keywords) 0 0 0
Condition0%0/3
$obj->Release_State eq "released" and $obj->Keywords
!ll&&!rl&&r
000
MC/DC0%0/2
$obj->Release_State eq "released" and $obj->Keywords
$obj->Release_State eq "released" $obj->Keywords
Truth table0%0/3
A and B
A= $obj->Release_State eq "released"B= $obj->Keywords
ABresult
0X0
100
111
32 #print "ok";
33 #warn $obj->Id;
34 0 foreach my $word ( split(/,/, langstring($obj->Keywords, $lang) ) ) {
35 #nur als Kleinbuchstaben speichern
36 0 $keywords{lc($word)} .= $obj->Id.",";
37 0 my $title = $obj->Title->{$lang};
38 0 ▶ if ($root->can("get_section")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($root->can("get_section")) 0 0 0
39 0 $title .= "|".$root->get_section($obj->Id);
40 }
41 0 $id2title{$obj->Id} = $title;
42 #print $word." " if ($debug);
43 }
44 }
45 0 });
46  
47 # Write keywords to file
48 0 my $file = $c->paths->pubhtmldir."/html/keywords_".$lang.".dat";
49 0 ▶ open (SEARCH, ">$file")
Branch: 1 branch
BranchTrueFalseTotal
open SEARCH, ">$file" or error("can't writeopen keyworddb $file") 0 0 0
50 or error( "can't writeopen keyworddb $file");
51 0 foreach my $key (sort keys %keywords) {
52 0 print SEARCH "$key|".$keywords{$key}."\n";
53 }
54 0 print SEARCH ">>> Id to title\n";
55 0 foreach my $id (sort keys %id2title) {
56 0 print SEARCH "$id=".$id2title{$id}."\n";
57 }
58 0 close SEARCH;
59 #print "<br>Keywords-Datei $file gespichert.\n";
60  
61 }
62 }
63  
64 1 1;
« WE_Frontend/Publish/Tgz.pm ↑ Summary WE/Util/Htpasswd.pm »