Merge pull request #24594 from kofemann/dcache

This commit is contained in:
Julius Härtl 2020-12-22 09:26:07 +01:00 committed by GitHub
commit 5094e29ebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 24 additions and 20 deletions

View File

@ -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 {

View File

@ -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);

View File

@ -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;
}
/**

View File

@ -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 {

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);