Skip to content

A free open source IT asset/license management system

Fix backup restoration when using a unix socket

Marie Ramloweb2efac7864b
diff --git a/app/Console/Commands/RestoreFromBackup.php b/app/Console/Commands/RestoreFromBackup.php
index ba5d9aa8df..f449420cc5 100644
--- a/app/Console/Commands/RestoreFromBackup.php
+++ b/app/Console/Commands/RestoreFromBackup.php
@@ -510,7 +510,9 @@ class RestoreFromBackup extends Command
' --batch '.
' --binary-mode '.
' -u '.escapeshellarg($connectionConfig['username']).' '.
- ' -P '.escapeshellarg($connectionConfig['port']).' '.
+ (empty($connectionConfig['unix_socket'])
+ ? ' -P '.escapeshellarg($connectionConfig['port'])
+ : ' -S '.escapeshellarg($connectionConfig['unix_socket'])). ' '.
escapeshellarg($connectionConfig['database']), // yanked -p since we pass via ENV
[0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']],
$pipes,