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