Merge pull request #373 from agstrxyz/patch-19

Interim update rest radius
This commit is contained in:
iBNu Maksum 2024-12-30 08:35:02 +07:00 committed by GitHub
commit 051a8de5f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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']) { if ($config['router_check']) {
echo "Checking router status...\n"; echo "Checking router status...\n";
@ -208,4 +225,4 @@ $timestampFile = "$UPLOAD_PATH/cron_last_run.txt";
file_put_contents($timestampFile, time()); file_put_contents($timestampFile, time());
run_hook('cronjob_end'); #HOOK run_hook('cronjob_end'); #HOOK