Impove cawangan debug connection commands

This commit is contained in:
Afiq Hamzah
2024-01-14 14:00:32 +08:00
parent 5e4b1ee781
commit 4becd04037
@@ -73,15 +73,26 @@ class CawanganDebugConnections extends Command
$idToNameMap[$item['mysql']] = $item['db_name'];
}
$tested_connection = '';
try {
$filteredArray2 = array_filter($array2, function ($item) use ($idToNameMap) {
$tested_connection = $idToNameMap[$item['mysql']];
return $idToNameMap[$item['mysql']] !== $item['database'];
});
} catch (\Throwable $th) {
dump(sprintf('Connection %s not found in table online_arrahn.arrahn_master_db but present in config. Make sure both of connection exist in both app/config and arrahn_master_db', $tested_connection));
return;
}
return $filteredArray2;
}
$filteredConnections = filterArraysByDatabaseNames($all_cawangan, $all_cawangan_in_config);
if($filteredConnections === null OR sizeof($filteredConnections) > 1){
return;
}
$isOK = true;
// checks if there is connection errors