diff --git a/app/Console/Commands/RestoreFromBackup.php b/app/Console/Commands/RestoreFromBackup.php index e780b35d69..fe778172c8 100644 --- a/app/Console/Commands/RestoreFromBackup.php +++ b/app/Console/Commands/RestoreFromBackup.php @@ -246,18 +246,21 @@ class RestoreFromBackup extends Command return false; } $bytes_read = 0; + while (($buffer = fgets($sql_contents, self::$buffer_size)) !== false) { $bytes_read += strlen($buffer); // \Log::debug("Buffer is: '$buffer'"); $bytes_written = fwrite($pipes[0], $buffer); + if ($bytes_written === false) { $stdout = fgets($pipes[1]); $this->info($stdout); $stderr = fgets($pipes[2]); $this->info($stderr); - return false; + } } + if (!feof($sql_contents) || $bytes_read == 0) { return $this->error("Not at end of file for sql file, or zero bytes read. aborting!"); }