Add condition to router check, if enable or not

This commit is contained in:
Focuslinkstech 2024-08-27 08:17:28 +01:00 committed by GitHub
parent 079b308bf1
commit edfa98e6b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 68 additions and 51 deletions

View File

@ -33,7 +33,7 @@ foreach ($d as $ds) {
$c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one(); $p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
$dvc = Package::getDevice($p); $dvc = Package::getDevice($p);
if($_app_stage != 'demo'){ if ($_app_stage != 'demo') {
if (file_exists($dvc)) { if (file_exists($dvc)) {
require_once $dvc; require_once $dvc;
(new $p['device'])->remove_customer($c, $p); (new $p['device'])->remove_customer($c, $p);
@ -79,13 +79,14 @@ foreach ($d as $ds) {
} }
} }
$routers = ORM::for_table('tbl_routers')->find_many(); if ($config['router_check']) {
if (!$routers) { $routers = ORM::for_table('tbl_routers')->find_many();
if (!$routers) {
echo "No routers found in the database.\n"; echo "No routers found in the database.\n";
exit; exit;
} }
foreach ($routers as $router) { foreach ($routers as $router) {
[$ip, $port] = explode(':', $router->ip_address); [$ip, $port] = explode(':', $router->ip_address);
$isOnline = false; $isOnline = false;
@ -132,10 +133,11 @@ foreach ($routers as $router) {
} }
$router->save(); $router->save();
} }
if ($isCli) { if ($isCli) {
echo "Cronjob finished\n"; echo "Cronjob finished\n";
} else { } else {
echo "</pre>"; echo "</pre>";
}
} }

View File

@ -621,6 +621,21 @@
<p class="help-block col-md-4">{Lang::T('This is to notify you when new updates is available')} <p class="help-block col-md-4">{Lang::T('This is to notify you when new updates is available')}
</p> </p>
</div> </div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Router Check')}</label>
<div class="col-md-6">
<select name="router_check" id="router_check" class="form-control">
<option value="0" {if $_c['router_check']=='0' }selected="selected"
{/if}>{Lang::T('Disabled')}
</option>
<option value="1" {if $_c['router_check']=='1' }selected="selected"
{/if}>{Lang::T('Enabled')}
</option>
</select>
</div>
<p class="help-block col-md-4">{Lang::T('If enabled, the system will notify Admin when router goes Offline, If admin have 10 or more router and many customers, it will get overlapping, you can disabled')}
</p>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Phone OTP Required')}</label> <label class="col-md-2 control-label">{Lang::T('Phone OTP Required')}</label>
<div class="col-md-6"> <div class="col-md-6">