query by archive settings retention

This commit is contained in:
M Alfiyan Syamsuddin 2021-09-02 13:49:38 +07:00
parent 54fd8a6459
commit 309fa0b15d
1 changed files with 10 additions and 1 deletions

View File

@ -71,12 +71,21 @@ class HistoryGraph
$archive->archive($server_id);
$now = new DateTime();
if(PSM_UPTIME_ARCHIVE == 'quarterly'){
$start_date = new DateTime('-3 month 0:0:0');
}else if(PSM_UPTIME_ARCHIVE == 'monthly'){
$start_date = new DateTime('-1 month 0:0:0');
}else{
$start_date = new DateTime('-1 week 0:0:0');
}
$last_week = new DateTime('-1 week 0:0:0');
$last_month = new DateTime('-1 month 0:0:0');
$last_year = new DateTime('-1 year -1 week 0:0:0');
$graphs = array(
0 => $this->generateGraphUptime($server_id, $last_month, $now),
0 => $this->generateGraphUptime($server_id, $start_date, $now),
1 => $this->generateGraphHistory($server_id, $last_year, $last_week),
);
$info_fields = array(