diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-12-22 09:26:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 09:26:07 +0100 |
commit | 5094e29ebda77f2f071fde349e4ad2a0683fedf8 (patch) | |
tree | 8e95877b12e47100606d7ca90e985c4f15964a07 | |
parent | a5c55891f5f7002b6dd2892b07e1cbddf57ff708 (diff) | |
parent | 4f2dc18f58737894f52f585203402307c64b595e (diff) | |
download | nextcloud-server-5094e29ebda77f2f071fde349e4ad2a0683fedf8.tar.gz nextcloud-server-5094e29ebda77f2f071fde349e4ad2a0683fedf8.zip |
Merge pull request #24594 from kofemann/dcache
-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/Local.php | 2 | ||||
-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 |
11 files changed, 24 insertions, 20 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 163185db541..8f5001c8143 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/Local.php b/lib/private/Files/Storage/Local.php index 240da595494..5d0ce596b11 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -557,7 +557,7 @@ class Local extends \OC\Files\Storage\Common { } public function writeStream(string $path, $stream, int $size = null): int { - $result = file_put_contents($this->getSourcePath($path), $stream); + $result = $this->file_put_contents($path, $stream); if ($result === false) { throw new GenericFileException("Failed write steam to $path"); } else { diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index fed4d26faf5..b837f77fbbc 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 d3b1880a813..8efb1c20980 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 10edd940d7d..4de1c091a97 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -122,8 +122,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 227e7d8e55e..e94f3714c9e 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 60a0917c040..11aa7434708 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); |