From 4421c573d240c69960086c1403ad3f7333a6d079 Mon Sep 17 00:00:00 2001 From: SJ Date: Wed, 26 Feb 2014 10:23:59 +0100 Subject: [PATCH] gui fix --- util/daily-report.php | 18 ++++++++++++++---- webui/system/database/mysql.php | 5 ++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/util/daily-report.php b/util/daily-report.php index 4b1cdc8e..11e28b74 100644 --- a/util/daily-report.php +++ b/util/daily-report.php @@ -91,12 +91,18 @@ $mail = new ModelMailMail(); $options = $health->get_options(); + $averagemessagesizeraw = $averagesqlsizeraw = $averagesphinxsizeraw = $daysleftatcurrentrate = 0; + /* these next counters are for projecting space */ $averagemessagesweekraw = ($processed_emails[1]) / 7; $averagemessagesmonthraw = ($processed_emails[2]) / 30; - $averagemessagesizeraw = $archivesizeraw / $counters['rcvd']; - $averagesqlsizeraw = $sqlsizeraw / $counters['rcvd']; - $averagesphinxsizeraw = $sphinxsizeraw / $counters['rcvd']; + + if($counters['rcvd'] > 0) { + $averagemessagesizeraw = $archivesizeraw / $counters['rcvd']; + $averagesqlsizeraw = $sqlsizeraw / $counters['rcvd']; + $averagesphinxsizeraw = $sphinxsizeraw / $counters['rcvd']; + } + $averagesizedayraw = ($averagemessagesizeraw+$averagesqlsizeraw+$averagesphinxsizeraw) * $averagemessagesweekraw; $datapart = 0; foreach($shortdiskinfo as $part) { @@ -108,7 +114,11 @@ $mail = new ModelMailMail(); $averagesqlsize = nice_size($averagesqlsizeraw,' '); // average metadata size in sql $averagesphinxsize = nice_size($averagesphinxsizeraw,' '); // average sphinx index $averagesizeday = nice_size($averagesizedayraw,' '); // average size per day - $daysleftatcurrentrate = convert_days_ymd($datapart / $averagesizedayraw); // number of days of free space left + + if($averagesizedayraw > 0) { + $daysleftatcurrentrate = convert_days_ymd($datapart / $averagesizedayraw); // number of days of free space left + } + if ( $averagemessagesweekraw > $averagemessagesmonthraw ) { $usagetrend = 1; } elseif( $averagemessagesweekraw < $averagemessagesmonthraw ) { diff --git a/webui/system/database/mysql.php b/webui/system/database/mysql.php index 7f02cf9f..32465ca5 100644 --- a/webui/system/database/mysql.php +++ b/webui/system/database/mysql.php @@ -42,7 +42,10 @@ class MySQL { $s = $this->link->prepare($sql); if(!$s) { return $query; } - $s->execute($arr); + try { + $s->execute($arr); + } + catch(PDOException $exception) { } $this->affected = $s->rowCount();