1 parent 91fd529 commit 78fb032Copy full SHA for 78fb032
1 file changed
deployer/requirements/task/check_disk_space.php
@@ -56,9 +56,11 @@ function detectDatabaseDatadir(array $credentials): ?string
56
return null;
57
}
58
59
- // Output format: "datadir\t/var/lib/mysql/"
60
- $columns = preg_split('/\s+/', $output);
61
- $path = is_array($columns) ? ($columns[1] ?? null) : null;
+ // Output format: "datadir\t/var/lib/mysql/", possibly preceded by mysql client warning lines
+ // on stderr (merged into stdout by runMysqlQuery()), so only the last line is relevant.
+ $lines = explode("\n", $output);
62
+ $columns = explode("\t", trim((string) end($lines)));
63
+ $path = $columns[1] ?? null;
64
65
return ('' !== $path && null !== $path) ? $path : null;
66
0 commit comments