From eb938bdba3f164b6d1f851636d1c2224c175ff53 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Thu, 25 Jul 2024 18:40:26 +0100 Subject: [PATCH] Create intermediate directories on restore if needed --- app/Console/Commands/RestoreFromBackup.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Console/Commands/RestoreFromBackup.php b/app/Console/Commands/RestoreFromBackup.php index 1cc9b280e1..9340b0363c 100644 --- a/app/Console/Commands/RestoreFromBackup.php +++ b/app/Console/Commands/RestoreFromBackup.php @@ -466,6 +466,9 @@ class RestoreFromBackup extends Command $ugly_file_name = $za->statIndex($file_details['index'])['name']; $fp = $za->getStream($ugly_file_name); //$this->info("Weird problem, here are file details? ".print_r($file_details,true)); + if (!is_dir($file_details['dest'])) { + mkdir($file_details['dest'], 0755, true); //0755 is what Laravel uses, so we do that + } $migrated_file = fopen($file_details['dest'].'/'.basename($pretty_file_name), 'w'); while (($buffer = fgets($fp, SQLStreamer::$buffer_size)) !== false) { fwrite($migrated_file, $buffer);