Fix Cron Router check, go to cache instead uploads folder. and check if Mikrotik using Default port

This commit is contained in:
Ibnu Maksum 2024-08-28 13:58:40 +07:00
parent 9772760146
commit d31274b983
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5

View File

@ -82,10 +82,10 @@ foreach ($d as $ds) {
if ($config['router_check']) {
$lockFile = '../system/uploads/router_monitor.lock';
$lockFile = $CACHE_PATH . '/router_monitor.lock';
if (!is_dir('../system/uploads/')) {
echo "Directory '/system/uploads/' does not exist. Exiting...\n";
if (!is_dir($CACHE_PATH)) {
echo "Directory '$CACHE_PATH' does not exist. Exiting...\n";
exit;
}
@ -115,7 +115,13 @@ if ($config['router_check']) {
$errors = [];
foreach ($routers as $router) {
[$ip, $port] = explode(':', $router->ip_address);
// check if custom port
if (strpos($router->ip_address, ':') === false){
$ip = $router->ip_address;
$port = 8728;
} else {
[$ip, $port] = explode(':', $router->ip_address);
}
$isOnline = false;
try {
@ -186,7 +192,7 @@ if ($config['router_check']) {
} else {
echo "</pre>";
}
flock($lock, LOCK_UN);
fclose($lock);
unlink($lockFile);