From 4becd04037cfbcc344220a84cb822868da19516a Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 14 Jan 2024 14:00:32 +0800 Subject: [PATCH] Impove cawangan debug connection commands --- app/Console/Commands/CawanganDebugConnections.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Console/Commands/CawanganDebugConnections.php b/app/Console/Commands/CawanganDebugConnections.php index c7cd7be..d4372f8 100644 --- a/app/Console/Commands/CawanganDebugConnections.php +++ b/app/Console/Commands/CawanganDebugConnections.php @@ -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