From 2170343958c90f75846155c1beecf7713ebe5767 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 10 Jan 2023 13:06:47 -0800 Subject: [PATCH] Fixed #12004: Snipe-IT restore didn't work on Windows --- app/Console/Commands/RestoreFromBackup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/RestoreFromBackup.php b/app/Console/Commands/RestoreFromBackup.php index 52d020974..c5e3a4c79 100644 --- a/app/Console/Commands/RestoreFromBackup.php +++ b/app/Console/Commands/RestoreFromBackup.php @@ -214,7 +214,7 @@ class RestoreFromBackup extends Command $env_vars['MYSQL_PWD'] = config('database.connections.mysql.password'); // TODO notes: we are stealing the dump_binary_path (which *probably* also has your copy of the mysql binary in it. But it might not, so we might need to extend this) // we unilaterally prepend a slash to the `mysql` command. This might mean your path could look like /blah/blah/blah//mysql - which should be fine. But maybe in some environments it isn't? - $mysql_binary = config('database.connections.mysql.dump.dump_binary_path').'/mysql'; + $mysql_binary = config('database.connections.mysql.dump.dump_binary_path').\DIRECTORY_SEPARATOR.'mysql'.(\DIRECTORY_SEPARATOR == '\\' ? ".exe" : ""); if( ! file_exists($mysql_binary) ) { return $this->error("mysql tool at: '$mysql_binary' does not exist, cannot restore. Please edit DB_DUMP_PATH in your .env to point to a directory that contains the mysqldump and mysql binary"); }