Update cron.php

radius rest interim update check
This commit is contained in:
AGSTR 2024-12-29 19:15:19 +07:00 committed by GitHub
parent 62c447da9b
commit 1906b1aefd
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']) {
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
run_hook('cronjob_end'); #HOOK