diff options
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/DAV.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/Flysystem.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encoding.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Jail.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Wrapper.php | 4 | ||||
-rw-r--r-- | lib/public/Files/Storage.php | 4 | ||||
-rw-r--r-- | lib/public/Files/Storage/IStorage.php | 4 |
10 files changed, 23 insertions, 19 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index e855c166612..9815fe6a245 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -439,9 +439,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { public function file_put_contents($path, $data) { $handle = $this->fopen($path, 'w+'); - fwrite($handle, $data); + $result = fwrite($handle, $data); fclose($handle); - return true; + return $result; } public function writeStream(string $path, $stream, int $size = null): int { diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 974feee8995..a2355f553c2 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -486,8 +486,8 @@ class DAV extends Common { /** * @param string $path - * @param string $data - * @return int + * @param mixed $data + * @return int|false */ public function file_put_contents($path, $data) { $path = $this->cleanPath($path); diff --git a/lib/private/Files/Storage/Flysystem.php b/lib/private/Files/Storage/Flysystem.php index a7747823acc..9b26516bef3 100644 --- a/lib/private/Files/Storage/Flysystem.php +++ b/lib/private/Files/Storage/Flysystem.php @@ -73,7 +73,11 @@ abstract class Flysystem extends Common { * {@inheritdoc} */ public function file_put_contents($path, $data) { - return $this->flysystem->put($this->buildPath($path), $data); + $result = $this->flysystem->put($this->buildPath($path), $data); + if ($result === true) { + return strlen($data); + } + return $result; } /** diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index a2ef1780d6c..875bdb29913 100644 --- a/lib/private/Files/Storage/Wrapper/Encoding.php +++ b/lib/private/Files/Storage/Wrapper/Encoding.php @@ -309,8 +309,8 @@ class Encoding extends Wrapper { * see http://php.net/manual/en/function.file_put_contents.php * * @param string $path - * @param string $data - * @return bool + * @param mixed $data + * @return int|false */ public function file_put_contents($path, $data) { return $this->storage->file_put_contents($this->findPathToUse($path), $data); diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 3a97764fbb8..38b252f8aaa 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -234,8 +234,8 @@ class Encryption extends Wrapper { * see http://php.net/manual/en/function.file_put_contents.php * * @param string $path - * @param string $data - * @return bool + * @param mixed $data + * @return int|false */ public function file_put_contents($path, $data) { // file put content will always be translated to a stream write diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php index 449a238096d..2396c07a0f1 100644 --- a/lib/private/Files/Storage/Wrapper/Jail.php +++ b/lib/private/Files/Storage/Wrapper/Jail.php @@ -259,8 +259,8 @@ class Jail extends Wrapper { * see http://php.net/manual/en/function.file_put_contents.php * * @param string $path - * @param string $data - * @return bool + * @param mixed $data + * @return int|false */ public function file_put_contents($path, $data) { return $this->getWrapperStorage()->file_put_contents($this->getUnjailedPath($path), $data); diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index 406f0fd4649..41fae7cafc9 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -121,8 +121,8 @@ class Quota extends Wrapper { * see http://php.net/manual/en/function.file_put_contents.php * * @param string $path - * @param string $data - * @return bool + * @param mixed $data + * @return int|false */ public function file_put_contents($path, $data) { $free = $this->free_space($path); diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index 4584bebe076..313f73f589e 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -250,8 +250,8 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea * see http://php.net/manual/en/function.file_put_contents.php * * @param string $path - * @param string $data - * @return bool + * @param mixed $data + * @return int|false */ public function file_put_contents($path, $data) { return $this->getWrapperStorage()->file_put_contents($path, $data); diff --git a/lib/public/Files/Storage.php b/lib/public/Files/Storage.php index d642512641d..2d89ce9f28e 100644 --- a/lib/public/Files/Storage.php +++ b/lib/public/Files/Storage.php @@ -230,8 +230,8 @@ interface Storage extends IStorage { * see http://php.net/manual/en/function.file_put_contents.php * * @param string $path - * @param string $data - * @return bool + * @param mixed $data + * @return int|false * @since 6.0.0 */ public function file_put_contents($path, $data); diff --git a/lib/public/Files/Storage/IStorage.php b/lib/public/Files/Storage/IStorage.php index f5073d1ad73..9cd5553b8bf 100644 --- a/lib/public/Files/Storage/IStorage.php +++ b/lib/public/Files/Storage/IStorage.php @@ -226,8 +226,8 @@ interface IStorage { * see http://php.net/manual/en/function.file_put_contents.php * * @param string $path - * @param string $data - * @return bool + * @param mixed $data + * @return int|false * @since 9.0.0 */ public function file_put_contents($path, $data); |