mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
performance improvement for the health page
This commit is contained in:
@ -40,31 +40,27 @@ class ModelHealthHealth extends Model {
|
||||
$now = time();
|
||||
|
||||
$ts = $now - 3600;
|
||||
$query = $this->db->query("select count(*) as count, sum(size) as size from " . TABLE_META . " where arrived > $ts");
|
||||
$query = $this->db->query("select count(*) as count 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, sum(size) as size from " . TABLE_META . " where arrived > $ts");
|
||||
$query = $this->db->query("select count(*) as count 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, sum(size) as size from " . TABLE_META . " where arrived > $ts");
|
||||
$query = $this->db->query("select count(*) as count 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, sum(size) as size from " . TABLE_META . " where arrived > $ts");
|
||||
$query = $this->db->query("select count(*) as count 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 $a;
|
||||
|
Reference in New Issue
Block a user