This commit is contained in:
SJ 2014-02-26 10:23:59 +01:00
parent 81b6f2357d
commit 4421c573d2
2 changed files with 18 additions and 5 deletions

View File

@ -91,12 +91,18 @@ $mail = new ModelMailMail();
$options = $health->get_options(); $options = $health->get_options();
$averagemessagesizeraw = $averagesqlsizeraw = $averagesphinxsizeraw = $daysleftatcurrentrate = 0;
/* these next counters are for projecting space */ /* these next counters are for projecting space */
$averagemessagesweekraw = ($processed_emails[1]) / 7; $averagemessagesweekraw = ($processed_emails[1]) / 7;
$averagemessagesmonthraw = ($processed_emails[2]) / 30; $averagemessagesmonthraw = ($processed_emails[2]) / 30;
$averagemessagesizeraw = $archivesizeraw / $counters['rcvd'];
$averagesqlsizeraw = $sqlsizeraw / $counters['rcvd']; if($counters['rcvd'] > 0) {
$averagesphinxsizeraw = $sphinxsizeraw / $counters['rcvd']; $averagemessagesizeraw = $archivesizeraw / $counters['rcvd'];
$averagesqlsizeraw = $sqlsizeraw / $counters['rcvd'];
$averagesphinxsizeraw = $sphinxsizeraw / $counters['rcvd'];
}
$averagesizedayraw = ($averagemessagesizeraw+$averagesqlsizeraw+$averagesphinxsizeraw) * $averagemessagesweekraw; $averagesizedayraw = ($averagemessagesizeraw+$averagesqlsizeraw+$averagesphinxsizeraw) * $averagemessagesweekraw;
$datapart = 0; $datapart = 0;
foreach($shortdiskinfo as $part) { foreach($shortdiskinfo as $part) {
@ -108,7 +114,11 @@ $mail = new ModelMailMail();
$averagesqlsize = nice_size($averagesqlsizeraw,' '); // average metadata size in sql $averagesqlsize = nice_size($averagesqlsizeraw,' '); // average metadata size in sql
$averagesphinxsize = nice_size($averagesphinxsizeraw,' '); // average sphinx index $averagesphinxsize = nice_size($averagesphinxsizeraw,' '); // average sphinx index
$averagesizeday = nice_size($averagesizedayraw,' '); // average size per day $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 ) { if ( $averagemessagesweekraw > $averagemessagesmonthraw ) {
$usagetrend = 1; $usagetrend = 1;
} elseif( $averagemessagesweekraw < $averagemessagesmonthraw ) { } elseif( $averagemessagesweekraw < $averagemessagesmonthraw ) {

View File

@ -42,7 +42,10 @@ class MySQL {
$s = $this->link->prepare($sql); $s = $this->link->prepare($sql);
if(!$s) { return $query; } if(!$s) { return $query; }
$s->execute($arr); try {
$s->execute($arr);
}
catch(PDOException $exception) { }
$this->affected = $s->rowCount(); $this->affected = $s->rowCount();