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

Diff of /rpms/smeserver-mailstats/contribs7/smeserver-mailstats-0.0.3-implementDBCreation.patch

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

Revision 1.1 by snetram, Sat Oct 4 08:46:59 2008 UTC Revision 1.2 by snetram, Sat Oct 11 23:29:50 2008 UTC
# Line 1  Line 1 
1  --- smeserver-mailstats-0.0.3/root/usr/bin/spamfilter-stats-7.pl.implementDBCreation    2008-10-04 10:25:00.000000000 +0200  --- smeserver-mailstats-0.0.3/root/etc/e-smith/templates/etc/e-smith/sql/init/smeserver-mailstats.sql.implementDBCreation       2008-10-12 01:05:19.000000000 +0200
2  +++ smeserver-mailstats-0.0.3/root/usr/bin/spamfilter-stats-7.pl        2008-10-04 10:36:33.000000000 +0200  +++ smeserver-mailstats-0.0.3/root/etc/e-smith/templates/etc/e-smith/sql/init/smeserver-mailstats.sql   2008-10-12 01:05:19.000000000 +0200
3  @@ -115,155 +115,6 @@  @@ -0,0 +1,91 @@
4   #            / Interval - "day", "week", "fortnight", "month", "99999" - last is number of seconds (default is day)  +CREATE DATABASE IF NOT EXISTS `mailstats`;
  #            / Base - "Midnight", "Midday", "Now", "99" hour (0-23) (default is midnight)  
  #  
 -#############################################################################  
 -#  
 -#  Table structure for MySQL table for saving data  
 -#  
 -# Database : `mailstats`  
 -#  
 -# use mailstats;  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `ColumnStats`  
 -#  
 -#  
 -#CREATE TABLE `ColumnStats` (  
 -#  `ColumnStatsid` int(11) NOT NULL auto_increment,  
 -#  `dateid` int(11) NOT NULL default '0',  
 -#  `timeid` int(11) NOT NULL default '0',  
 -#  `descr` varchar(20) NOT NULL default '',  
 -#  `count` bigint(20) NOT NULL default '0',  
 -#  `servername` varchar(30) NOT NULL default '',  
 -#  PRIMARY KEY  (`ColumnStatsid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `JunkMailStats`  
 -#  
 -  
 -#CREATE TABLE `JunkMailStats` (  
 -#  `JunkMailstatsid` int(11) NOT NULL auto_increment,  
 -#  `dateid` int(11) NOT NULL default '0',  
 -# `user` varchar(12) NOT NULL default '',  
 -#  `count` bigint(20) NOT NULL default '0',  
 -#  `servername` varchar(30) default NULL,  
 -#  PRIMARY KEY  (`JunkMailstatsid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -#  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `SARules`  
 -#  
 -  
 -#CREATE TABLE `SARules` (  
 -#  `SARulesid` int(11) NOT NULL auto_increment,  
 -#  `dateid` int(11) NOT NULL default '0',  
 -#  `rule` varchar(50) NOT NULL default '',  
 -#  `count` bigint(20) NOT NULL default '0',  
 -#  `totalhits` bigint(20) NOT NULL default '0',  
 -#  `servername` varchar(30) NOT NULL default '',  
 -#  PRIMARY KEY  (`SARulesid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `SAscores`  
 -#  
 -  
 -#CREATE TABLE `SAscores` (  
 -#  `SAscoresid` int(11) NOT NULL auto_increment,  
 -#  `dateid` int(11) NOT NULL default '0',  
 -#  `acceptedcount` bigint(20) NOT NULL default '0',  
 -#  `rejectedcount` bigint(20) NOT NULL default '0',  
 -#  `hamcount` bigint(20) NOT NULL default '0',  
 -#  `acceptedscore` decimal(20,2) NOT NULL default '0.00',  
 -#  `rejectedscore` decimal(20,2) NOT NULL default '0.00',  
 -#  `hamscore` decimal(20,2) NOT NULL default '0.00',  
 -#  `totalsmtp` bigint(20) NOT NULL default '0',  
 -#  `totalrecip` bigint(20) NOT NULL default '0',  
 -#  `servername` varchar(30) NOT NULL default '',  
 -#  PRIMARY KEY  (`SAscoresid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `VirusStats`  
 -#  
 -  
 -#CREATE TABLE `VirusStats` (  
 -#  `VirusStatsid` int(11) NOT NULL auto_increment,  
 -#  `dateid` int(11) NOT NULL default '0',  
 -#  `descr` varchar(40) NOT NULL default '',  
 -#  `count` bigint(20) NOT NULL default '0',  
 -#  `servername` varchar(30) NOT NULL default '',  
 -#  PRIMARY KEY  (`VirusStatsid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -#  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `date`  
 -#  
 -  
 -#CREATE TABLE `date` (  
 -#  `dateid` int(11) NOT NULL auto_increment,  
 -#  `date` date NOT NULL default '0000-00-00',  
 -#  PRIMARY KEY  (`dateid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -#  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `domains`  
 -#  
 -  
 -#CREATE TABLE `domains` (  
 -#  `domainsid` int(11) NOT NULL auto_increment,  
 -#  `dateid` int(11) NOT NULL default '0',  
 -#  `domain` varchar(40) NOT NULL default '',  
 -#  `type` varchar(10) NOT NULL default '',  
 -#  `total` bigint(20) NOT NULL default '0',  
 -#  `denied` bigint(20) NOT NULL default '0',  
 -#  `xfererr` bigint(20) NOT NULL default '0',  
 -#  `accept` bigint(20) NOT NULL default '0',  
 -#  `servername` varchar(30) NOT NULL default '',  
 -#  PRIMARY KEY  (`domainsid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `qpsmtpdcodes`  
 -#  
 -  
 -#CREATE TABLE `qpsmtpdcodes` (  
 -#  `qpsmtpdcodesid` int(11) NOT NULL auto_increment,  
 -#  `dateid` int(11) NOT NULL default '0',  
 -#  `reason` varchar(40) NOT NULL default '',  
 -#  `count` bigint(20) NOT NULL default '0',  
 -#  `servername` varchar(30) NOT NULL default '',  
 -#  PRIMARY KEY  (`qpsmtpdcodesid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -  
 -# --------------------------------------------------------  
 -  
 -#  
 -# Table structure for table `time`  
 -#  
 -  
 -#CREATE TABLE `time` (  
 -#  `timeid` int(11) NOT NULL auto_increment,  
 -#  `time` time NOT NULL default '00:00:00',  
 -#  PRIMARY KEY  (`timeid`)  
 -#) ENGINE=MyISAM DEFAULT CHARSET=latin1;  
 -#  
 -#############################################################################  
   
  # internal modules (part of core perl distribution)  
  use strict;  
 @@ -1361,7 +1212,7 @@  
      # now fill in day related stats  - must always check for it already there  
      # incase the module is run more than once in a day  
      my $SAScoresid = check_date_rec($dbh,"SAscores",$dateid,$servername);  
 -    $dbh->do( "UPDATE SAscores SET ".  
 +    $dbh->do( "UPDATE sascores SET ".  
            "acceptedcount=".$spamcount.  
            ",rejectedcount=".$above15.  
            ",hamcount=".$hamcount.  
 @@ -1374,19 +1225,19 @@  
        "' WHERE SAscoresid =".$SAScoresid);  
      # Junkmail stats  
      # delete if already there  
 -    $dbh->do("DELETE from JunkMailStats WHERE dateid = ".$dateid." AND servername='".$servername."'");  
 +    $dbh->do("DELETE from junkmailstats WHERE dateid = ".$dateid." AND servername='".$servername."'");  
      # and add records  
      foreach my $thisuser (keys %junkcount){  
 -    $dbh->do("INSERT INTO JunkMailStats (dateid,user,count,servername) VALUES ('".  
 +    $dbh->do("INSERT INTO junkmailstats (dateid,user,count,servername) VALUES ('".  
        $dateid."','".$thisuser."','".$junkcount{$thisuser}."','".$servername."')");  
        $reccount++;  
      }  
      #SA rules - delete any first  
 -    $dbh->do("DELETE from SARules WHERE dateid = ".$dateid." AND servername='".$servername."'");  
 +    $dbh->do("DELETE from sarules WHERE dateid = ".$dateid." AND servername='".$servername."'");  
      # and add records  
      foreach my $thisrule (keys %found_SARules){  
 -       $dbh->do("INSERT INTO SARules (dateid,rule,count,totalhits,servername) VALUES ('".  
 -               $dateid."','".$thisrule."','".$found_SARules{$thisrule}{'count'}."','".  
 +       $dbh->do("INSERT INTO sarules (dateid,rule,count,totalhits,servername) VALUES ('".  
 +               $dateid."','".$thisrule."','".$found_sarules{$thisrule}{'count'}."','".  
                 $found_SARules{$thisrule}{'totalhits'}."','".$servername."')");  
                 $reccount++;  
      }  
 @@ -1399,10 +1250,10 @@  
         $reccount++;  
  }  
      # virus stats  
 -    $dbh->do("DELETE from VirusStats WHERE dateid = ".$dateid." AND servername='".$servername."'");  
 +    $dbh->do("DELETE from virusstats WHERE dateid = ".$dateid." AND servername='".$servername."'");  
      # and add records  
      foreach my $thisvirus (keys %found_viruses){  
 -           $dbh->do("INSERT INTO VirusStats (dateid,descr,count,servername) VALUES ('".  
 +           $dbh->do("INSERT INTO virusstats (dateid,descr,count,servername) VALUES ('".  
           $dateid."','".$thisvirus."','".$found_viruses{$thisvirus}."','".$servername."')");  
         $reccount++;  
   
 @@ -1453,17 +1304,17 @@  
               $reportdate = $currentdate;  
             }  
          # delete for this date and time  
 -        $dbh->do("DELETE from ColumnStats WHERE dateid = ".$dateid." AND timeid = ".$timeid." AND servername='".$servername."'");  
 +        $dbh->do("DELETE from columnstats WHERE dateid = ".$dateid." AND timeid = ".$timeid." AND servername='".$servername."'");  
             while ( $ncateg < @categs-1 ) {  
              # then add in each entry  
              if (($counts{$nhour}{$categs[$ncateg]} || 0) != 0) {  
 -                   $dbh->do("INSERT INTO ColumnStats (dateid,timeid,descr,count,servername) VALUES ("  
 +                   $dbh->do("INSERT INTO columnstats (dateid,timeid,descr,count,servername) VALUES ("  
                     .$dateid.",".$timeid.",'".$categs[$ncateg]."',"  
                     .$counts{$nhour}{$categs[$ncateg]}.",'".$servername."')");  
                 $reccount++;  
          }  
   
 -# print("INSERT INTO ColumnStats (dateid,timeid,descr,count) VALUES ("  
 +# print("INSERT INTO columnstats (dateid,timeid,descr,count) VALUES ("  
  #            .$dateid.",".$timeid.",'".$categs[$ncateg]."',"  
  #            .$counts{$nhour}{$categs[$ncateg]}.")\n");  
   
 --- smeserver-mailstats-0.0.3/root/etc/e-smith/templates/etc/e-smith/sql/mailstats-create-schema.sql.implementDBCreation        2008-10-04 10:26:03.000000000 +0200  
 +++ smeserver-mailstats-0.0.3/root/etc/e-smith/templates/etc/e-smith/sql/mailstats-create-schema.sql    2008-10-04 10:30:51.000000000 +0200  
 @@ -0,0 +1,90 @@  
 +IF NOT EXISTS CREATE DATABASE `mailstats`;  
5  +  +
6  +USE `mailstats`;  +USE `mailstats`;
7  +  +
8  +IF NOT EXISTS CREATE TABLE `columnstats` (  +CREATE TABLE IF NOT EXISTS `ColumnStats` (
9  +  `ColumnStatsid` int(11) NOT NULL auto_increment,  +  `ColumnStatsid` int(11) NOT NULL auto_increment,
10  +  `dateid` int(11) NOT NULL default '0',  +  `dateid` int(11) NOT NULL default '0',
11  +  `timeid` int(11) NOT NULL default '0',  +  `timeid` int(11) NOT NULL default '0',
# Line 241  Line 15 
15  +  PRIMARY KEY  (`ColumnStatsid`)  +  PRIMARY KEY  (`ColumnStatsid`)
16  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
17  +  +
18  +IF NOT EXISTS CREATE TABLE `junkmailstats` (  +CREATE TABLE IF NOT EXISTS `JunkMailStats` (
19  +  `JunkMailstatsid` int(11) NOT NULL auto_increment,  +  `JunkMailstatsid` int(11) NOT NULL auto_increment,
20  +  `dateid` int(11) NOT NULL default '0',  +  `dateid` int(11) NOT NULL default '0',
21  +  `user` varchar(12) NOT NULL default '',  + `user` varchar(12) NOT NULL default '',
22  +  `count` bigint(20) NOT NULL default '0',  +  `count` bigint(20) NOT NULL default '0',
23  +  `servername` varchar(30) default NULL,  +  `servername` varchar(30) default NULL,
24  +  PRIMARY KEY  (`JunkMailstatsid`)  +  PRIMARY KEY  (`JunkMailstatsid`)
25  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
26  +  +
27  +IF NOT EXISTS CREATE TABLE `sarules` (  +CREATE TABLE IF NOT EXISTS `SARules` (
28  +  `SARulesid` int(11) NOT NULL auto_increment,  +  `SARulesid` int(11) NOT NULL auto_increment,
29  +  `dateid` int(11) NOT NULL default '0',  +  `dateid` int(11) NOT NULL default '0',
30  +  `rule` varchar(50) NOT NULL default '',  +  `rule` varchar(50) NOT NULL default '',
# Line 260  Line 34 
34  +  PRIMARY KEY  (`SARulesid`)  +  PRIMARY KEY  (`SARulesid`)
35  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
36  +  +
37  +IF NOT EXISTS CREATE TABLE `sascores` (  +CREATE TABLE IF NOT EXISTS `SAscores` (
38  +  `SAscoresid` int(11) NOT NULL auto_increment,  +  `SAscoresid` int(11) NOT NULL auto_increment,
39  +  `dateid` int(11) NOT NULL default '0',  +  `dateid` int(11) NOT NULL default '0',
40  +  `acceptedcount` bigint(20) NOT NULL default '0',  +  `acceptedcount` bigint(20) NOT NULL default '0',
# Line 275  Line 49 
49  +  PRIMARY KEY  (`SAscoresid`)  +  PRIMARY KEY  (`SAscoresid`)
50  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
51  +  +
52  +IF NOT EXISTS CREATE TABLE `virusstats` (  +CREATE TABLE IF NOT EXISTS `VirusStats` (
53  +  `VirusStatsid` int(11) NOT NULL auto_increment,  +  `VirusStatsid` int(11) NOT NULL auto_increment,
54  +  `dateid` int(11) NOT NULL default '0',  +  `dateid` int(11) NOT NULL default '0',
55  +  `descr` varchar(40) NOT NULL default '',  +  `descr` varchar(40) NOT NULL default '',
# Line 284  Line 58 
58  +  PRIMARY KEY  (`VirusStatsid`)  +  PRIMARY KEY  (`VirusStatsid`)
59  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
60  +  +
61  +IF NOT EXISTS CREATE TABLE `date` (  +CREATE TABLE IF NOT EXISTS `date` (
62  +  `dateid` int(11) NOT NULL auto_increment,  +  `dateid` int(11) NOT NULL auto_increment,
63  +  `date` date NOT NULL default '0000-00-00',  +  `date` date NOT NULL default '0000-00-00',
64  +  PRIMARY KEY  (`dateid`)  +  PRIMARY KEY  (`dateid`)
65  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
66  +  +
67  +IF NOT EXISTS CREATE TABLE `domains` (  +
68    +CREATE TABLE IF NOT EXISTS `domains` (
69  +  `domainsid` int(11) NOT NULL auto_increment,  +  `domainsid` int(11) NOT NULL auto_increment,
70  +  `dateid` int(11) NOT NULL default '0',  +  `dateid` int(11) NOT NULL default '0',
71  +  `domain` varchar(40) NOT NULL default '',  +  `domain` varchar(40) NOT NULL default '',
# Line 303  Line 78 
78  +  PRIMARY KEY  (`domainsid`)  +  PRIMARY KEY  (`domainsid`)
79  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
80  +  +
81  +IF NOT EXISTS CREATE TABLE `qpsmtpdcodes` (  +CREATE TABLE IF NOT EXISTS `qpsmtpdcodes` (
82  +  `qpsmtpdcodesid` int(11) NOT NULL auto_increment,  +  `qpsmtpdcodesid` int(11) NOT NULL auto_increment,
83  +  `dateid` int(11) NOT NULL default '0',  +  `dateid` int(11) NOT NULL default '0',
84  +  `reason` varchar(40) NOT NULL default '',  +  `reason` varchar(40) NOT NULL default '',
# Line 312  Line 87 
87  +  PRIMARY KEY  (`qpsmtpdcodesid`)  +  PRIMARY KEY  (`qpsmtpdcodesid`)
88  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
89  +  +
90  +IF NOT EXISTS CREATE TABLE `time` (  +CREATE TABLE IF NOT EXISTS `time` (
91  +  `timeid` int(11) NOT NULL auto_increment,  +  `timeid` int(11) NOT NULL auto_increment,
92  +  `time` time NOT NULL default '00:00:00',  +  `time` time NOT NULL default '00:00:00',
93  +  PRIMARY KEY  (`timeid`)  +  PRIMARY KEY  (`timeid`)
94  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;  +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
95    --- smeserver-mailstats-0.0.3/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeserver-mailstats.sql.implementDBCreation      2008-10-12 00:54:31.000000000 +0200
96    +++ smeserver-mailstats-0.0.3/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeserver-mailstats.sql  2008-10-12 00:55:01.000000000 +0200
97    @@ -0,0 +1 @@
98    +PERMS=0540


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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