[! use strict; use Proxmox::Utils; use Proxmox::HTMLTable; use Proxmox::RuleDB; use Proxmox::Statistic; !] [- my @cellwidth = ('350px', '390px'); my @header = ('3', '200px', __('Quarantine Status')); my $out = ""; my $ruledb = Proxmox::RuleDB->new (); my $dbh = $ruledb->{dbh}; my $table = Proxmox::HTMLTable->new (\@cellwidth); $table->add_headline (\@header); 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 = 'S'"); $sth->execute(); my $ref; if (($ref = $sth->fetchrow_hashref()) && $ref->{count}) { my $hdi = Proxmox::Utils::get_hd_info ('/'); my ($total, $used) = ($hdi->{total}, $hdi->{used}); my $hd_used = int ($used*100/ $total)*2; my $hd_free = 200 - $hd_used; my $stat = Proxmox::Statistic->out_membar ($hd_used, $hd_free); my $txt = __("HD Space") . " (${total}MB/${used}MB)"; $table->add_row ('', $txt, $stat); $table->add_row ('', __("Quarantine Size (MBytes on disk)"), int ($ref->{mbytes})); $table->add_row ('', __("Number of Mails"), $ref->{count}); $table->add_row ('', __("Average Size (Bytes)"), int ($ref->{avgbytes})); $table->add_row ('', __("Average Spam level"), int($ref->{avgspam})); $out .= $table->out_table(); } else { $out .= "
" . __("Quarantine is empty."); } print OUT $out; -]