Skip to content

Commit

Permalink
Merge pull request #15169 from uberbrady/create_directories_when_need…
Browse files Browse the repository at this point in the history
…ed_on_restore

Create intermediate directories on restore if needed - Fixes [SC-25950]
  • Loading branch information
snipe authored Jul 25, 2024
2 parents 62655be + eb938bd commit f77d300
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Console/Commands/RestoreFromBackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ public function handle()
$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);
Expand Down

0 comments on commit f77d300

Please sign in to comment.