Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/backup.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2022-08-25 15:08:22 +0300
committerMaxence Lange <maxence@artificial-owl.com>2022-08-25 15:08:33 +0300
commit7b1a20e25653a727ed0ea3e819c762542a7f77bb (patch)
tree2c346848a08146957957dbf56c27e43a47b0fa39
parent1ad7bae5f9a8182742ffb2bded8a0259716ec64d (diff)
fix stream from sqldump zip file
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rwxr-xr-xlib/Command/PointRestore.php14
-rw-r--r--lib/Service/ChunkService.php25
2 files changed, 8 insertions, 31 deletions
diff --git a/lib/Command/PointRestore.php b/lib/Command/PointRestore.php
index 7afe916..0f53c29 100755
--- a/lib/Command/PointRestore.php
+++ b/lib/Command/PointRestore.php
@@ -784,11 +784,13 @@ class PointRestore extends Base {
*/
private function importSqlDump(RestoringPoint $point, RestoringChunk $chunk, array $sqlParams): void {
try {
- $read = $this->chunkService->getStreamFromChunk(
- $point,
- $chunk,
- PointService::SQL_DUMP_FILE
- );
+ $zip = $this->chunkService->openZipArchive($point, $chunk, true);
+ $stream = $zip->getStream(PointService::SQL_DUMP_FILE);
+ unlink($zip->filename);
+
+ if ($stream === false) {
+ throw new RestoreChunkException('cannot open stream');
+ }
} catch (ArchiveCreateException
| ArchiveNotFoundException
| RestoreChunkException
@@ -801,7 +803,7 @@ class PointRestore extends Base {
$sqlDump = $this->pointService->getSqlDump($sqlParams);
$sqlDump->setup($sqlParams);
- $sqlDump->import($sqlParams, $read);
+ $sqlDump->import($sqlParams, $stream);
}
diff --git a/lib/Service/ChunkService.php b/lib/Service/ChunkService.php
index 8d9c008..de1dae2 100644
--- a/lib/Service/ChunkService.php
+++ b/lib/Service/ChunkService.php
@@ -300,31 +300,6 @@ class ChunkService {
/**
- * @param RestoringPoint $point
- * @param RestoringChunk $chunk
- * @param string $filename
- *
- * @return resource
- * @throws ArchiveCreateException
- * @throws ArchiveNotFoundException
- * @throws NotFoundException
- * @throws NotPermittedException
- * @throws RestoreChunkException
- */
- public function getStreamFromChunk(RestoringPoint $point, RestoringChunk $chunk, string $filename) {
- $zip = $this->openZipArchive($point, $chunk, true);
- $stream = $zip->getStream($filename);
- unlink($zip->filename);
-
- if ($stream === false) {
- throw new RestoreChunkException('cannot open stream');
- }
-
- return $stream;
- }
-
-
- /**
* @param ZipArchive $zip
* @param string $root
* @param ArchiveFile[] $archiveFiles