File: makestorconf.in

package info (click to toggle)
inn2 2.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,720 kB
  • ctags: 8,983
  • sloc: ansic: 92,499; sh: 13,509; perl: 12,921; makefile: 2,985; yacc: 842; python: 342; lex: 255
file content (56 lines) | stat: -rw-r--r-- 1,170 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /usr/bin/perl -w
# fixscript will replace this line with code to load INN::Config

# Create storage.conf script based on recently read articles.

$readfile="$INN::Config::pathdb/readgroups";

$outfile="$INN::Config::pathdb/storage.conf";
outloop: 
for ($level=9 ; $level >= 2; --$level) {
  # clear groups hash.
  foreach $i (keys %groups) {
    delete $groups{$i};
  }
  if (open(RDF, "$INN::Config::sort $readfile|")) {
    while (<RDF>) {
      chop;
      next if (/^group/);	# bogus 
      @foo=split(/ /);		# foo[0] should be group, foo[1] lastreadtime
      @bar=split(/\./,$foo[0]);
      if ( $level >= scalar @bar) {
	$grf = join(".", @bar);
      } else {
	$grf=join(".", @bar[0..($level-1)])  . ".*";
      }
      $groups{$grf} = 1;
    }
    close(RDF);
  }
  $grlist = join(",",keys(%groups));
  last outloop if (length($grlist) < 2048);
}

open(OUT, ">$outfile") || die "cant open $outfile";
#open(OUT, ">/dev/tty");

print OUT <<"EOF" ;
method cnfs {
	newsgroups: control,control.*
	class: 1
	options: MINI
}

method timecaf {
	newsgroups: $grlist
	class: 1
}

method cnfs {
	newsgroups: *
	options: MONGO
        class: 0
}
EOF
close(OUT);
exit(0);