From 1906b1aefd02aeb96d061d020c9651cd0a76a8fc Mon Sep 17 00:00:00 2001 From: AGSTR <144728914+agstrxyz@users.noreply.github.com> Date: Sun, 29 Dec 2024 19:15:19 +0700 Subject: [PATCH] Update cron.php radius rest interim update check --- system/cron.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/system/cron.php b/system/cron.php index b6b12800..16bef18a 100644 --- a/system/cron.php +++ b/system/cron.php @@ -103,6 +103,23 @@ foreach ($d as $ds) { } } + //Cek interim-update radiusrest + if ($config['frrest_interim_update'] != 0) { + + $r_a = ORM::for_table('rad_acct') + ->whereRaw("BINARY acctstatustype = 'Start' OR acctstatustype = 'Interim-Update'") + ->where_lte('dateAdded', date("Y-m-d H:i:s"))->find_many(); + + foreach ($r_a as $ra) { + $interval = $_c['frrest_interim_update']*60; + $timeUpdate = strtotime($ra['dateAdded'])+$interval; + $timeNow = strtotime(date("Y-m-d H:i:s")); + if ($timeNow >= $timeUpdate) { + $ra->acctstatustype = 'Stop'; + $ra->save(); + } + } +} if ($config['router_check']) { echo "Checking router status...\n"; @@ -208,4 +225,4 @@ $timestampFile = "$UPLOAD_PATH/cron_last_run.txt"; file_put_contents($timestampFile, time()); -run_hook('cronjob_end'); #HOOK \ No newline at end of file +run_hook('cronjob_end'); #HOOK