From a0a3de23595f16762844fbe87c2a8d50033bde67 Mon Sep 17 00:00:00 2001 From: Deon Thomas Date: Sat, 25 Mar 2023 13:56:01 -0400 Subject: [PATCH] fix uploading gz snapshot --- src/Snapshot.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Snapshot.php b/src/Snapshot.php index bc7791c..dcde77b 100644 --- a/src/Snapshot.php +++ b/src/Snapshot.php @@ -91,12 +91,14 @@ protected function shouldIgnoreLine(string $line): bool protected function loadStream(string $connectionName = null) { LazyCollection::make(function () { - $stream = $this->disk->readStream($this->fileName); + $stream = $this->compressionExtension === 'gz' + ? gzopen($this->disk->path($this->fileName), 'r') + : $this->disk->readStream($this->fileName); $statement = ''; while (! feof($stream)) { $chunk = $this->compressionExtension === 'gz' - ? gzdecode(gzread($stream, self::STREAM_BUFFER_SIZE)) + ? gzread($stream, self::STREAM_BUFFER_SIZE) : fread($stream, self::STREAM_BUFFER_SIZE); $lines = explode("\n", $chunk);