From 309fa0b15db0f151959671c02f1b7fe3de2c06e1 Mon Sep 17 00:00:00 2001 From: M Alfiyan Syamsuddin Date: Thu, 2 Sep 2021 13:49:38 +0700 Subject: [PATCH] query by archive settings retention --- src/psm/Util/Server/HistoryGraph.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/psm/Util/Server/HistoryGraph.php b/src/psm/Util/Server/HistoryGraph.php index 9c2be688..c61e07b5 100644 --- a/src/psm/Util/Server/HistoryGraph.php +++ b/src/psm/Util/Server/HistoryGraph.php @@ -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(