return $data;
};
+my $get_quarantine_table_data = sub {
+ my ($dbh, $qtype) = @_;
+
+ # Note;: We try to estimate used disk space - each mail
+ # is stored in an extra file ...
+
+ my $bs = 4096;
+
+ my $sth = $dbh->prepare(
+ "SELECT count(ID) as count, sum (ceil((Bytes+$bs-1)/$bs)*$bs) / (1024*1024) as mbytes, " .
+ "avg(Bytes) as avgbytes, avg(Spamlevel) as avgspam " .
+ "FROM CMailStore WHERE QType = ?");
+
+ $sth->execute($qtype);
+
+ my $ref = $sth->fetchrow_hashref();
+
+ $sth->finish;
+
+ return undef if !($ref && $ref->{count});
+
+ my $data = [];
+
+ push @$data, {
+ text => "Quarantine Size (MBytes)",
+ value => int($ref->{mbytes}),
+ };
+
+ push @$data, {
+ text => "Number of Mails",
+ value => $ref->{count},
+ };
+
+ push @$data, {
+ text => "Average Size (Bytes)",
+ value => int($ref->{avgbytes}),
+ };
+
+ if ($qtype eq 'S') {
+ push @$data, {
+ text => "Average Spam Level",
+ value => int($ref->{avgspam}),
+ };
+ }
+
+ return $data;
+};
+
__PACKAGE__->register_method ({
name => 'pmgreport',
path => 'pmgreport',
$vars->{virusstat} = $data;
}
+ if (my $data = $get_quarantine_table_data->($rdb->{dbh}, 'V')) {
+ $vars->{virusquar} = $data;
+ }
+
+ if (my $data = $get_quarantine_table_data->($rdb->{dbh}, 'S')) {
+ $vars->{spamquar} = $data;
+ }
+
my $tt = PMG::Config::get_template_toolkit();
my $cfg = PMG::Config->new();
border: 1px solid black;
border-collapse: collapse;
}
-
+
</style>
</head>
<body>
[% FOREACH item IN system %]
<tr>
<td>[% item.text %]</td>
- <td>[% item.value %]</td>
+ <td style="width:150px;">[% item.value %]</td>
</tr>
[% END %]
</table>
</table>
[% END %]
+ [% IF virusquar %]
+ <h2>Virus Quarantine</h2>
+ <table>
+ [% FOREACH item IN virusquar %]
+ <tr>
+ <td>[% item.text %]</td>
+ <td style="width:150px;">[% item.value %]</td>
+ </tr>
+ [% END %]
+ </table>
+ [% END %]
+
+ [% IF spamquar %]
+ <h2>Spam Quarantine</h2>
+ <table>
+ [% FOREACH item IN spamquar %]
+ <tr>
+ <td>[% item.text %]</td>
+ <td style="width:150px;">[% item.value %]</td>
+ </tr>
+ [% END %]
+ </table>
+ [% END %]
+
</body>
</html>