Skip to content

Commit 9732fa7

Browse files
fix: skip local socket fallback when database host is remote
1 parent 6e5e0da commit 9732fa7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

deployer/requirements/task/health.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,13 @@
7171
}
7272
}
7373

74+
$isRemoteDb = $dbCredentials !== null
75+
&& $dbCredentials['host'] !== '127.0.0.1'
76+
&& $dbCredentials['host'] !== 'localhost';
77+
7478
// Fallback: try mysqladmin ping without credentials (uses ~/.my.cnf or socket)
75-
if (!$dbChecked) {
79+
// Skip for remote hosts — a local socket hit would be a false positive.
80+
if (!$dbChecked && !$isRemoteDb) {
7681
try {
7782
run("$adminCmd ping --silent 2>/dev/null");
7883
addRequirementRow('Database server', REQUIREMENT_OK, "$dbLabel responding");
@@ -84,10 +89,6 @@
8489

8590
// Only check for local processes if the database host is local (or unknown)
8691
if (!$dbChecked) {
87-
$isRemoteDb = $dbCredentials !== null
88-
&& $dbCredentials['host'] !== '127.0.0.1'
89-
&& $dbCredentials['host'] !== 'localhost';
90-
9192
if ($isRemoteDb) {
9293
addRequirementRow('Database server', REQUIREMENT_FAIL, sprintf(
9394
'Cannot reach %s on %s:%d',

0 commit comments

Comments
 (0)