chiark / gitweb /
Split nameIsInList into nameIsInListRegexp (for most things) and nameIsInListExactly...
[modbot-mtm.git] / stump / bin / stump-report.pl
1 #!/usr/bin/perl
2 #
3 # This script processes the logfile given as it first command argument, 
4 # and prints a nice report about approved, rejected, etc postings, to
5 # stdout.
6 #
7 # is called from report.sh
8 #
9
10 # get the directory where robomod is residing
11 $MNG_ROOT = $ENV{'MNG_ROOT'} || die "Root dir for moderation not specified";
12
13 # common library
14 require "$MNG_ROOT/bin/robomod.pl";
15
16 $logFile = $ARGV[0]   || die "A log file name must be specified";
17 open( LOG, $logFile ) || die "Can't open logfile $logFile for reading";
18
19 $approvedCount = 0;
20 $autoCount     = 0;
21 $rejectedCount = 0;
22 $preApprovedCount = 0;
23
24 while( <LOG> ) {
25   $approvedCount++    if( /processApproved/i );
26   $autoCount++        if( /PREAPPROVED/ );
27   $rejectedCount++    if( /processRejected/i );
28 #  $approvedCount++    if( /processPreapproved/i );
29   $preApprovedCount++ if( /processPreapproved/i );
30 }
31
32 print "
33
34 Approved:       $approvedCount  messages (of them, $autoCount automatically)
35 Rejected:       $rejectedCount  messages
36 Preapproved:    $preApprovedCount       new posters
37 " or die $!;