improved health page

This commit is contained in:
SJ 2014-10-23 09:31:40 +02:00
parent 0f962a9bcf
commit 02bbe16a20
3 changed files with 34 additions and 11 deletions

View File

@ -36,25 +36,38 @@ class ModelHealthHealth extends Model {
public function count_processed_emails() {
$today = $last_7_days = $last_30_days = 0;
$a = array();
$now = time();
$ts = $now - 3600;
$query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) { $last_60_mins = $query->row['count']; }
$query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) {
$a['last_60_mins_count'] = $query->row['count'];
$a['last_60_mins_size'] = $query->row['size'];
}
$ts = $now - 86400;
$query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) { $today = $query->row['count']; }
$query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) {
$a['today_count'] = $query->row['count'];
$a['today_size'] = $query->row['size'];
}
$ts = $now - 604800;
$query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) { $last_7_days = $query->row['count']; }
$query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) {
$a['last_7_days_count'] = $query->row['count'];
$a['last_7_days_size'] = $query->row['size'];
}
$ts = $now - 2592000;
$query = $this->db->query("select count(*) as count from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) { $last_30_days = $query->row['count']; }
$query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts");
if(isset($query->row['count'])) {
$a['last_30_days_count'] = $query->row['count'];
$a['last_30_days_size'] = $query->row['size'];
}
return array($last_60_mins, $today, $last_7_days, $last_30_days);
return $a;
}

View File

@ -107,7 +107,12 @@
</tr>
<tr>
<td><?php print $text_processed_emails; ?></td>
<td><?php print $processed_emails[0]; ?> (<?php print $text_60_minutes; ?>)<br /><?php print $processed_emails[1]; ?> (<?php print $text_24_hours; ?>)<br /><?php print $processed_emails[2]; ?> (<?php print $text_1_week; ?>)<br /><?php print $processed_emails[3]; ?> (<?php print $text_30_days; ?>)</td>
<td>
<?php print $processed_emails['last_60_mins_count']; ?> / <?php print nice_size($processed_emails['last_60_mins_size']); ?> (<?php print $text_60_minutes; ?>)<br />
<?php print $processed_emails['today_count']; ?> / <?php print nice_size($processed_emails['today_size']); ?> (<?php print $text_24_hours; ?>)<br />
<?php print $processed_emails['last_7_days_count']; ?> / <?php print nice_size($processed_emails['last_7_days_size']); ?> (<?php print $text_1_week; ?>)<br />
<?php print $processed_emails['last_30_days_count']; ?> / <?php print nice_size($processed_emails['last_30_days_size']); ?> (<?php print $text_30_days; ?>)
</td>
</tr>
<tr>
<th colspan="2"><?php print $text_message_disposition; ?></th>

View File

@ -52,7 +52,12 @@
<div class="row">
<div class="cellhealthleft"><?php print $text_processed_emails; ?></div>
<div class="cellhealthright"><?php print $processed_emails[0]; ?> (<?php print $text_60_minutes; ?>)<br /><?php print $processed_emails[1]; ?> (<?php print $text_24_hours; ?>)<br /><?php print $processed_emails[2]; ?> (<?php print $text_1_week; ?>)<br /><?php print $processed_emails[3]; ?> (<?php print $text_30_days; ?>)</div>
<div class="cellhealthright">
<?php print $processed_emails['last_60_mins_count']; ?> / <?php print nice_size($processed_emails['last_60_mins_size']); ?> (<?php print $text_60_minutes; ?>)<br />
<?php print $processed_emails['today_count']; ?> / <?php print nice_size($processed_emails['today_size']); ?> (<?php print $text_24_hours; ?>)<br />
<?php print $processed_emails['last_7_days_count']; ?> / <?php print nice_size($processed_emails['last_7_days_size']); ?> (<?php print $text_1_week; ?>)<br />
<?php print $processed_emails['last_30_days_count']; ?> / <?php print nice_size($processed_emails['last_30_days_size']); ?> (<?php print $text_30_days; ?>)
</div>
</div>
<div class="row">