From fc5f4dbc2ffdba9030ec4d4bda9d0875ba3f880d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 10 Mar 2025 20:41:08 +0100 Subject: [PATCH] Fix regression on missing resource put Some external libraries did rely on the usage of putResource. This method wasn't part of the new filesystem interface and was therefore breaking those implementations. --- packages/filesystem/src/FileSystem.php | 3 +++ packages/filesystem/src/FlySystemAdapter.php | 6 ++++++ packages/filesystem/src/FlysystemV1/FlysystemV1.php | 6 ++++++ packages/filesystem/src/FlysystemV3/FlysystemV3.php | 6 ++++++ 4 files changed, 21 insertions(+) diff --git a/packages/filesystem/src/FileSystem.php b/packages/filesystem/src/FileSystem.php index 107fce6bb..ceb322027 100644 --- a/packages/filesystem/src/FileSystem.php +++ b/packages/filesystem/src/FileSystem.php @@ -46,6 +46,9 @@ public function read(string $path): string|false; public function put(string $path, string $contents): bool; + /** @param resource $resource */ + public function putStream(string $path, $resource): void; + /** @return StorageAttributes[] */ public function listContents(string $directory = '', bool $recursive = false): array; diff --git a/packages/filesystem/src/FlySystemAdapter.php b/packages/filesystem/src/FlySystemAdapter.php index 80591da08..329187561 100644 --- a/packages/filesystem/src/FlySystemAdapter.php +++ b/packages/filesystem/src/FlySystemAdapter.php @@ -75,6 +75,12 @@ public function put(string $path, string $contents): bool return $this->filesystem->put($path, $contents); } + /** @param resource $resource */ + public function putStream(string $path, $resource): void + { + $this->filesystem->putStream($path, $resource); + } + /** @return StorageAttributes[] */ public function listContents(string $directory = '', bool $recursive = false): array { diff --git a/packages/filesystem/src/FlysystemV1/FlysystemV1.php b/packages/filesystem/src/FlysystemV1/FlysystemV1.php index c8515bb2d..1a4698e6d 100644 --- a/packages/filesystem/src/FlysystemV1/FlysystemV1.php +++ b/packages/filesystem/src/FlysystemV1/FlysystemV1.php @@ -52,6 +52,12 @@ public function put(string $path, string $contents): bool return $this->filesystem->put($path, $contents); } + /** @param resource $resource */ + public function putStream(string $path, $resource): void + { + $this->filesystem->putStream($path, $resource); + } + /** @return StorageAttributes[] */ public function listContents(string $directory = '', bool $recursive = false): array { diff --git a/packages/filesystem/src/FlysystemV3/FlysystemV3.php b/packages/filesystem/src/FlysystemV3/FlysystemV3.php index 0d1bdeb11..c5e9ce84a 100644 --- a/packages/filesystem/src/FlysystemV3/FlysystemV3.php +++ b/packages/filesystem/src/FlysystemV3/FlysystemV3.php @@ -52,6 +52,12 @@ public function put(string $path, string $contents): bool return true; } + /** @param resource $resource */ + public function putStream(string $path, $resource): void + { + $this->filesystem->writeStream($path, $resource); + } + /** @return FileAttributes[] */ public function listContents(string $directory = '', bool $recursive = false): array {