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