Merged in afiqhamzah/chores/improve-output-command-cawangan-debug-connections (pull request #77)
Afiqhamzah/chores/improve output command cawangan debug connections
This commit is contained in:
@@ -82,23 +82,37 @@ class CawanganDebugConnections extends Command
|
||||
|
||||
$filteredConnections = filterArraysByDatabaseNames($all_cawangan, $all_cawangan_in_config);
|
||||
|
||||
$isOK = true;
|
||||
|
||||
// checks if there is connection errors
|
||||
if (Helper::getInactiveCawanganDbConnection() > 0) {
|
||||
if (sizeof(Helper::getInactiveCawanganDbConnection()) > 0) {
|
||||
dump('Inactive cawangan connection detected : ');
|
||||
dump('1. Check DB_HOST in .env status is alive and available');
|
||||
dump('2. Check database in .env exist in DB_HOST');
|
||||
dump('');
|
||||
dump(Helper::getInactiveCawanganDbConnection());
|
||||
$isOK = false;
|
||||
}
|
||||
|
||||
// checks if config connection do not exist referring to arrahn_master_db
|
||||
if (count($all_cawangan) !== count($all_cawangan_in_config)) {
|
||||
$db_not_config = array_diff(array_column($all_cawangan, 'db_name'), array_column($all_cawangan_in_config, 'database'));
|
||||
|
||||
dump(implode(', ', $db_not_config) . ' not configured in database config');
|
||||
dump(implode(', ', $db_not_config) . ' exist in arrahn_master_db but not configured in config/database.php');
|
||||
$isOK = false;
|
||||
}
|
||||
|
||||
// checks if config connection databases are not tally fwith arrahn master db
|
||||
if (count($filteredConnections) !== 0) {
|
||||
dump('Database config names are not tally arrahn_master_db : ');
|
||||
dump($filteredConnections);
|
||||
$isOK = false;
|
||||
}
|
||||
|
||||
if($isOK == true){
|
||||
dump('Cawangan database configuration is OK');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user