/[smecontribs]/rpms/smeserver-mailstats/contribs7/smeserver-mailstats-0.0.3-bjrupdate03.patch
ViewVC logotype

Contents of /rpms/smeserver-mailstats/contribs7/smeserver-mailstats-0.0.3-bjrupdate03.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Tue Nov 25 16:20:25 2008 UTC (15 years, 11 months ago) by slords
Branch: MAIN
CVS Tags: smeserver-mailstats-0_0_3-15_el4_sme, smeserver-mailstats-0_0_3-14_el4_sme, HEAD
Changes since 1.2: +0 -0 lines
Restore

1 --- smeserver-mailstats-0.0.3/root/usr/bin/spamfilter-stats-7.pl.bjrupdate03 2008-04-11 15:14:32.000000000 +0100
2 +++ smeserver-mailstats-0.0.3/root/usr/bin/spamfilter-stats-7.pl 2008-04-08 15:57:20.000000000 +0100
3 @@ -86,6 +86,8 @@
4 # - Added code to save stats to MySQL DB (defaulted to off)
5 # - Fixed interval so that it analyzes Midnight to midnight
6 # - Allow varied interval for report
7 +# 0.6.21 - bjr - Move initial test (and create) for mailstats prop before
8 +# first reference to mailstats
9 #
10 # TODO
11 # ----
12 @@ -109,8 +111,8 @@
13 # / SaveDataToMySQL - save data to MySQL database (default is "no")
14 # / DBHost - MySQL server hostname (default is "localhost").
15 # / DBPort - MySQL server post (default is "3306")
16 -# / Interval - "day", "week", "fortnight", "month", "99999" - last is number of seconds
17 -# / Base - "Midnight", "Midday", "Now", "99" hour (0-23)
18 +# / Interval - "day", "week", "fortnight", "month", "99999" - last is number of seconds (default is day)
19 +# / Base - "Midnight", "Midday", "Now", "99" hour (0-23) (default is midnight)
20 #
21 #############################################################################
22 #
23 @@ -118,7 +120,7 @@
24 #
25 # Database : `mailstats`
26 #
27 -
28 +# use mailstats;
29 # --------------------------------------------------------
30
31 #
32 @@ -279,9 +281,21 @@
33 my $hostname = hostname();
34 my $cdb = esmith::ConfigDB->open_ro or die "Couldn't open ConfigDB : $!\n";
35
36 +my $true = 1;
37 +my $false = 0;
38 +#and see if mailstats are disabled
39 +my $disabled;
40 +if ($cdb->get('mailstats')){
41 + $disabled = !(($cdb->get('mailstats')->prop('Status') || 'enabled') eq 'enabled');
42 +} else {
43 + my $db = esmith::ConfigDB->open; my $record = $db->new_record('mailstats', { type => 'report', Status => 'enabled', Email => 'admin' });
44 + $cdb = esmith::ConfigDB->open_ro or die "Couldn't open ConfigDB : $!\n"; #Open up again to pick up new record
45 + $disabled = $false;
46 +}
47 +
48 #Configuration section
49 my %opt = (
50 - version => '0.6.20', # please update at each change.
51 + version => '0.6.21', # please update at each change.
52 debug => 0, # guess what ?
53 sendmail => '/usr/sbin/sendmail', # Path to sendmail stub
54 from => 'spamfilter-stats', # Who is the mail from
55 @@ -305,9 +319,6 @@
56 my $maxcutoff = 1; #max percent cutoff applied
57 my $mincutoff = 0.2; #min percent cutoff applied
58
59 -my $true = 1;
60 -my $false = 0;
61 -
62 my $tstart = time;
63
64 #Local variables
65 @@ -341,7 +352,6 @@
66 my @colwidth = (); #width of each column
67 #(auto means only if non zero) - populated from possible db entries
68 my @finaldisplay = (); #final decision on display or not - true or false
69 -my $disabled;
70
71 #count column names, used for headings - also used for DB mailstats property names
72 my $CATHOUR='Hour';
73 @@ -440,15 +450,6 @@
74 # check that logterse is in use
75 #my pluginfile = '/var/service/qpsmtpd/config/peers/0';
76
77 -#and see if mailstats are disabled
78 -if ($cdb->get('mailstats')){
79 - $disabled = !(($cdb->get('mailstats')->prop('Status') || 'enabled') eq 'enabled');
80 -} else {
81 - my $db = esmith::ConfigDB->open; my $record = $db->new_record('mailstats', { type => 'report', Status => 'enabled' });
82 - $disabled = $false;
83 -}
84 -
85 -
86 if ( !$RHSenabled || !$DNSenabled ) {
87 $rblnotset = '*';
88 }
89 @@ -1070,7 +1071,7 @@
90 if ($savedata) { save_data(); }
91 else
92 { print "No data saved - if you want to save data to a MySQL database, then please use:\n".
93 - "config setprop mailstats SaveDataToMySQL yes\n";
94 + "config setprop mailstats SaveDataToMySQL yes\nYou must have created the database first.";
95 }
96
97
98 @@ -1348,7 +1349,7 @@
99 print "Saving data..";
100 my $dbh = DBI->connect( "DBI:mysql:database=$DBname;host=$host;port=$port",
101 "mailstats", "mailstats" )
102 - or die "Cannot open db";
103 + or die "Cannot open mailstats db - has it beeen created?";
104
105 my $hour = floor( $start / 3600 );
106 my $reportdate = strftime( "%F", localtime( $hour * 3600 ) );

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed